Skip to content

Commit bd45017

Browse files
committed
Make API compatible with released library version
1 parent 2aec27c commit bd45017

File tree

1 file changed

+1
-32
lines changed

1 file changed

+1
-32
lines changed

Diff for: src/Board.cpp

+1-32
Original file line numberDiff line numberDiff line change
@@ -137,38 +137,7 @@ void Board::enableSleepWhenIdle(){
137137

138138
#if defined(ARDUINO_PORTENTA_C33)
139139
bool Board::enableWakeupFromRTC(uint32_t hours, uint32_t minutes, uint32_t seconds, void (* const callbackFunction)(), RTClock * rtc){
140-
lowPower->enableWakeupFromRTC();
141-
142-
RTCTime currentTime;
143-
if (!rtc -> getTime(currentTime)) {
144-
return false;
145-
}
146-
delay(1);
147-
148-
// Convert current time to UNIX timestamp and add the desired interval
149-
time_t currentTimestamp = currentTime.getUnixTime();
150-
currentTimestamp += hours * 3600 + minutes * 60 + seconds;
151-
152-
// Convert back to RTCTime
153-
RTCTime alarmTime(currentTimestamp);
154-
155-
// Configure the alarm match criteria
156-
AlarmMatch match;
157-
match.addMatchSecond(); // Trigger the alarm when the seconds match
158-
match.addMatchMinute(); // Trigger the alarm when the minutes match
159-
match.addMatchHour(); // Trigger the alarm when the hours match
160-
161-
// Set the alarm callback (assuming you have a callback function named alarmCallback)
162-
if (callbackFunction && !rtc -> setAlarmCallback(callbackFunction, alarmTime, match)) {
163-
return false; // Failed to set the alarm
164-
} else {
165-
// Set the alarm without a callback
166-
if (!rtc -> setAlarm(alarmTime, match)) {
167-
return false; // Failed to set the alarm
168-
}
169-
}
170-
delay(1);
171-
return true;
140+
return lowPower->setWakeUpAlarm(hours, minutes, seconds, callbackFunction, rtc);
172141
}
173142

174143
bool Board::enableWakeupFromRTC(uint32_t hours, uint32_t minutes, uint32_t seconds, RTClock * rtc){

0 commit comments

Comments
 (0)