Description
We expect to be able to use the attachInterrupt(digitalPinToInterrupt(pin), ISR, mode)
syntax, even when the use of digitalPinToInterrupt
is not absolutely necessary due to the interrupts having the same numbering as the pins (e.g. SAMD). This allows code to be written that is portable across architectures.
This is not currently possible with Arduino megaAVR Boards. Arduino megaAVR Boards' attachInterrupt
was written to take a pin number as the first parameter, then convert the pin number to interrupt number inside attachInterrupt
using digitalPinToInterrupt
, breaking from the convention established in Arduino AVR Boards.
To make matters more confusing, the attachInterrupt
documentation falsely claims:
For Uno WiFiRev.2, Due, Zero, MKR Family and 101 boards the interrupt number = pin number.
The attachInterrupt
documentation also specifically says that the attachInterrupt(pin, ISR, mode)
syntax is not recommended.
Originally reported at:
http://forum.arduino.cc/index.php?topic=592249