diff --git a/src/ArduinoLowPower.h b/src/ArduinoLowPower.h index 6863349..8ac559a 100644 --- a/src/ArduinoLowPower.h +++ b/src/ArduinoLowPower.h @@ -18,6 +18,12 @@ #define RTC_ALARM_WAKEUP 0xFF +#ifdef ARDUINO_API_VERSION +using irq_mode = PinStatus; +#else +using irq_mode = uint32_t; +#endif + //typedef void (*voidFuncPtr)( void ) ; typedef void (*onOffFuncPtr)( bool ) ; @@ -59,7 +65,7 @@ class ArduinoLowPowerClass { deepSleep((uint32_t)millis); } - void attachInterruptWakeup(uint32_t pin, voidFuncPtr callback, uint32_t mode); + void attachInterruptWakeup(uint32_t pin, voidFuncPtr callback, irq_mode mode); #ifdef BOARD_HAS_COMPANION_CHIP void companionLowPowerCallback(onOffFuncPtr callback) { diff --git a/src/samd/ArduinoLowPower.cpp b/src/samd/ArduinoLowPower.cpp index fb8646f..1ba0f7c 100644 --- a/src/samd/ArduinoLowPower.cpp +++ b/src/samd/ArduinoLowPower.cpp @@ -1,7 +1,6 @@ #if defined(ARDUINO_ARCH_SAMD) #include "ArduinoLowPower.h" -#include "WInterrupts.h" static void configGCLK6() { @@ -72,7 +71,7 @@ void ArduinoLowPowerClass::deepSleep(uint32_t millis) { void ArduinoLowPowerClass::setAlarmIn(uint32_t millis) { if (!rtc.isConfigured()) { - attachInterruptWakeup(RTC_ALARM_WAKEUP, NULL, 0); + attachInterruptWakeup(RTC_ALARM_WAKEUP, NULL, (irq_mode)0); } uint32_t now = rtc.getEpoch(); @@ -80,7 +79,7 @@ void ArduinoLowPowerClass::setAlarmIn(uint32_t millis) { rtc.enableAlarm(rtc.MATCH_YYMMDDHHMMSS); } -void ArduinoLowPowerClass::attachInterruptWakeup(uint32_t pin, voidFuncPtr callback, uint32_t mode) { +void ArduinoLowPowerClass::attachInterruptWakeup(uint32_t pin, voidFuncPtr callback, irq_mode mode) { if (pin > PINS_COUNT) { // check for external wakeup sources