arduino-libraries / ArduinoLowPower

Powersave features for SAMD boards
GNU Lesser General Public License v2.1
82 stars 57 forks source link

wrong assumption, that `pin > PINS_COUNT` cannot yield valid pins for interrupts #9

Closed polygamma closed 5 years ago

polygamma commented 5 years ago

e.g. the Arduino MKRFOX1200 has the SIGFOX_EVENT_PIN on 33, whereas PINS_COUNT yields 26, which leads to the SigFox library being unable to register interrupts for wakeups based on those events.

Compare with: https://github.com/arduino-libraries/SigFox/blob/master/src/SigFox.cpp#L170

This pull request changes the logic to detect invalid pins slightly, so that using the SIGFOX_EVENT_PIN for interrupts is now possible.

Edit: I have appended something else. This commit together with this also fixes this, the problems with Serial not working after sleeping.