@@ -43,14 +43,13 @@ void ArduinoLowPowerClass::setAlarmIn(uint32_t millis) {
4343
4444 uint32_t now = rtc.getEpoch ();
4545 rtc.setAlarmEpoch (now + millis/1000 );
46- rtc.enableAlarm (rtc.MATCH_YYMMDDHHMMSS );
46+ rtc.enableAlarm (rtc.MATCH_HHMMSS );
4747}
4848
4949void ArduinoLowPowerClass::attachInterruptWakeup (uint32_t pin, voidFuncPtr callback, uint32_t mode) {
5050
5151 if (pin > PINS_COUNT) {
5252 // check for external wakeup sources
53- // only enables the wakeup bit, no callback
5453 // RTC library should call this API to enable the alarm subsystem
5554 switch (pin) {
5655 case RTC_ALARM_WAKEUP:
@@ -65,9 +64,9 @@ void ArduinoLowPowerClass::attachInterruptWakeup(uint32_t pin, voidFuncPtr callb
6564 if (in == NOT_AN_INTERRUPT || in == EXTERNAL_INT_NMI)
6665 return ;
6766
67+ pinMode (pin, INPUT_PULLUP);
6868 attachInterrupt (pin, callback, mode);
6969
70- #if 0
7170 // enable EIC clock
7271 GCLK->CLKCTRL .bit .CLKEN = 0 ; // disable GCLK module
7372 while (GCLK->STATUS .bit .SYNCBUSY );
@@ -80,13 +79,13 @@ void ArduinoLowPowerClass::attachInterruptWakeup(uint32_t pin, voidFuncPtr callb
8079
8180 GCLK->GENCTRL .bit .RUNSTDBY = 1 ; // GCLK6 run standby
8281 while (GCLK->STATUS .reg & GCLK_STATUS_SYNCBUSY);
83- #endif
8482
8583 // Enable wakeup capability on pin in case being used during sleep
8684 EIC->WAKEUP .reg |= (1 << in);
8785
8886 /* Errata: Make sure that the Flash does not power all the way down
8987 * when in sleep mode. */
88+
9089 NVMCTRL->CTRLB .bit .SLEEPPRM = NVMCTRL_CTRLB_SLEEPPRM_DISABLED_Val;
9190}
9291
0 commit comments