conflict with attachInterrupt

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
cyborg5
Posts: 1
Joined: Tue Mar 17, 2015 1:12 am

conflict with attachInterrupt

Post by cyborg5 » Tue Mar 17, 2015 1:28 am

I maintain a library of code called IRLib which receives, decodes, and sends infrared signals. One of the objects in the library makes use of the standard arduino function "attachInterrupt". When I compile a sketch with my library and V-USB I get a linking conflict with INT0_vect. This occurs even if there is no instance of an object containing this function call. My library provides a variety of ways to receive signals some of which make use of "attachInterrupt" and some do not. So even if I'm not using those particular methods where the objects containing those methods, even if I only use objects and methods that do not make use of the built in interrupt handling, they still get linkage errors.

Is there something unique about using INT0_vect that V-USB has to use it? I know that the timing is really critical in your library. I know you can't disable interrupts for very long messes things up. If you guys used some other interest method would be compatible with Arduino's standard attachInterrupt? I would think other users might have a similar conflict that could not be coded around.

Meanwhile they can set up a conditional compile on my library that would force the user to use parts of my library that were not in conflict. But I thought you guys might want to be aware of the situation perhaps in future versions you could have a workaround.

blargg
Rank 3
Rank 3
Posts: 102
Joined: Thu Nov 14, 2013 10:01 pm

Re: conflict with attachInterrupt

Post by blargg » Tue Mar 17, 2015 10:43 am

INT0 is used to give it highest priority. You could probably rewire USB to use INT1 without problem (and make the appropriate change to usbconfig.h), since interrupts are disabled during USB activity. Even when USB uses INT0, you generally have to make the other interrupt handlers non-blocking with ISR_NOBLOCK, otherwise they'll keep interrupts disabled for too long.

runfifa123
Posts: 3
Joined: Thu Apr 30, 2015 3:49 am
Contact:

Re: conflict with attachInterrupt

Post by runfifa123 » Tue May 05, 2015 3:06 am

This occurs even if there is no instance of an object containing this function call. My library provides a variety of ways to receive signals some of which make use of "attachInterrupt" and some do not. So even if I'm not using those particular methods where the objects containing those methods, even if I only use objects and methods that do not make use of the built in interrupt handling, they still get linkage errors.

Post Reply