Pages: [1]   Go Down
Author Topic: Need a friendlier way to handle interrupt vector conflicts  (Read 1078 times)
0 Members and 1 Guest are viewing this topic.
Ontario
Offline Offline
God Member
*****
Karma: 25
Posts: 910
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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.
Logged

Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: