@@ -43,14 +43,13 @@ void ArduinoLowPowerClass::setAlarmIn(uint32_t millis) {
43
43
44
44
uint32_t now = rtc.getEpoch ();
45
45
rtc.setAlarmEpoch (now + millis/1000 );
46
- rtc.enableAlarm (rtc.MATCH_YYMMDDHHMMSS );
46
+ rtc.enableAlarm (rtc.MATCH_HHMMSS );
47
47
}
48
48
49
49
void ArduinoLowPowerClass::attachInterruptWakeup (uint32_t pin, voidFuncPtr callback, uint32_t mode) {
50
50
51
51
if (pin > PINS_COUNT) {
52
52
// check for external wakeup sources
53
- // only enables the wakeup bit, no callback
54
53
// RTC library should call this API to enable the alarm subsystem
55
54
switch (pin) {
56
55
case RTC_ALARM_WAKEUP:
@@ -65,9 +64,9 @@ void ArduinoLowPowerClass::attachInterruptWakeup(uint32_t pin, voidFuncPtr callb
65
64
if (in == NOT_AN_INTERRUPT || in == EXTERNAL_INT_NMI)
66
65
return ;
67
66
67
+ pinMode (pin, INPUT_PULLUP);
68
68
attachInterrupt (pin, callback, mode);
69
69
70
- #if 0
71
70
// enable EIC clock
72
71
GCLK->CLKCTRL .bit .CLKEN = 0 ; // disable GCLK module
73
72
while (GCLK->STATUS .bit .SYNCBUSY );
@@ -80,13 +79,13 @@ void ArduinoLowPowerClass::attachInterruptWakeup(uint32_t pin, voidFuncPtr callb
80
79
81
80
GCLK->GENCTRL .bit .RUNSTDBY = 1 ; // GCLK6 run standby
82
81
while (GCLK->STATUS .reg & GCLK_STATUS_SYNCBUSY);
83
- #endif
84
82
85
83
// Enable wakeup capability on pin in case being used during sleep
86
84
EIC->WAKEUP .reg |= (1 << in);
87
85
88
86
/* Errata: Make sure that the Flash does not power all the way down
89
87
* when in sleep mode. */
88
+
90
89
NVMCTRL->CTRLB .bit .SLEEPPRM = NVMCTRL_CTRLB_SLEEPPRM_DISABLED_Val;
91
90
}
92
91
0 commit comments