Go Down

Topic: Need a friendlier way to handle interrupt vector conflicts (Read 1 time) previous topic - next topic

gardner

Folks seem to be constantly tripping over interrupt vector conflicts in libraries that want to make use of AVR interrupts that Wiring doesn't handle.  The common culprits are:  NewSoftSerial, NewPing, IRremote, Tone and probably dozens of others.  Searching the forums for '"multiple definition of" __vector' will turn up a lot.

There's room for improvement in the diagnostics on these, but it does require establishing some best practices.  How about if library developers were encouraged to do something like this?

Code: [Select]
#if ISR_2_INUSE
#  error Library NewFrobnitz requires use of ISR2, but it is used by ISR_2_INUSE
#else
#  define ISR_2_INUSE NewFrobnitz
#endif


That would allow the CPP to generate a more sensible error describing the conflict straight off, and would lead to less frustration from end users.

WizenedEE

Another idea is that the IDE could do a regex for that error message (it already does some others IIRC) and then replace it with "Library "xxx.cpp" and "yyy.cpp" use the same interrupt vector" and perhaps do a reverse lookup to find out the pretty name.

Go Up