Skip to content

Commit b9d4f27

Browse files
committed
Use RTC alarm without callback
1 parent 249760b commit b9d4f27

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

Diff for: examples/Standby_WakeFromRTC_C33/Standby_WakeFromRTC_C33.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ void setup() {
4545
}
4646
}
4747

48-
board.enableWakeupFromRTC(0, 0, 10, [](){}, &RTC); // Sleep for 10 seconds
48+
// board.enableWakeupFromRTC(0, 0, 10, [](){}); // Sleep for 10 seconds
49+
board.enableWakeupFromRTC(0, 0, 10); // Sleep for 10 seconds
4950

5051
delay(1000); // Let the user see that the board is ready to sleep
5152

Diff for: src/Board.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,18 @@ bool Board::enableWakeupFromRTC(uint32_t hours, uint32_t minutes, uint32_t secon
164164
return false; // Failed to set the alarm
165165
} else {
166166
// Set the alarm without a callback
167-
// if (!rtc -> setAlarm(alarmTime, match)) {
168-
// return false; // Failed to set the alarm
169-
// }
167+
if (!rtc -> setAlarm(alarmTime, match)) {
168+
return false; // Failed to set the alarm
169+
}
170170
}
171171
delay(1);
172172
return true;
173173
}
174+
175+
bool Board::enableWakeupFromRTC(uint32_t hours, uint32_t minutes, uint32_t seconds, RTClock * rtc){
176+
return enableWakeupFromRTC(hours, minutes, seconds, nullptr, rtc);
177+
}
178+
174179
#endif
175180

176181
#if defined(ARDUINO_PORTENTA_H7) || defined(ARDUINO_NICLA_VISION)

Diff for: src/Board.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ class Board {
137137
* If no RTC instance is provided, the default RTC instance is used.
138138
* @return True if successful, false otherwise.
139139
*/
140-
bool enableWakeupFromRTC(uint32_t hours, uint32_t minutes, uint32_t seconds, void (* const callbackFunction)() = nullptr, RTClock * rtc = &RTC);
140+
bool enableWakeupFromRTC(uint32_t hours, uint32_t minutes, uint32_t seconds, void (* const callbackFunction)(), RTClock * rtc = &RTC);
141+
bool enableWakeupFromRTC(uint32_t hours, uint32_t minutes, uint32_t seconds, RTClock * rtc = &RTC);
141142
#endif
142143

143144
#if defined(ARDUINO_PORTENTA_H7)

0 commit comments

Comments
 (0)