@@ -137,38 +137,7 @@ void Board::enableSleepWhenIdle(){
137
137
138
138
#if defined(ARDUINO_PORTENTA_C33)
139
139
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);
172
141
}
173
142
174
143
bool Board::enableWakeupFromRTC (uint32_t hours, uint32_t minutes, uint32_t seconds, RTClock * rtc){
0 commit comments