@@ -100,7 +100,6 @@ class Board {
100
100
*/
101
101
void enableWakeupFromPin ();
102
102
103
-
104
103
/* *
105
104
* Enables sleep mode when the board is idle.
106
105
*/
@@ -117,62 +116,29 @@ class Board {
117
116
#endif
118
117
119
118
120
- /* *
121
- * Enables wake-up of the device from the RTC.
122
- */
123
- void enableWakeupFromRTC ();
124
-
125
119
#if defined(ARDUINO_PORTENTA_C33)
126
- // TODO Do I needs to call enableWakeupFromRTC() before calling this function?
127
120
/* *
128
- * @brief Put the device in sleep mode for a specified amount of time. Restarts after waking up .
121
+ * @brief Enables wake-up of the device from the RTC .
129
122
* This function allows to use a custom RTC instance to put the device in sleep mode.
130
123
* @param hours The number of hours to sleep.
131
124
* @param minutes The number of minutes to sleep.
132
125
* @param seconds The number of seconds to sleep.
133
126
* @param callbackFunction The function to call when the device wakes up.
127
+ * If no callback function is provided, the device will wake up without calling any function.
134
128
* @param rtc The RTC instance to use for the sleep function.
129
+ * If no RTC instance is provided, the default RTC instance is used.
135
130
* @return True if successful, false otherwise.
136
131
*/
137
- bool sleepFor (int hours, int minutes, int seconds, void (* const callbackFunction)(), RTClock * rtc);
138
-
139
- /* *
140
- * @brief Put the device in sleep mode for a specified amount of time.
141
- * This function uses the default RTC instance to put the device in sleep mode.
142
- * @param hours The number of hours to sleep.
143
- * @param minutes The number of minutes to sleep.
144
- * @param seconds The number of seconds to sleep.
145
- * @param callbackFunction The function to call when the device wakes up.
146
- * @return True if successful, false otherwise.
147
- */
148
- bool sleepFor (int hours, int minutes, int seconds, void (* const callbackFunction)());
132
+ void enableWakeupFromRTC (uint32_t hours, uint32_t minutes, uint32_t seconds, void (* const callbackFunction)() = nullptr, RTClock * rtc = &RTC);
149
133
#endif
150
134
151
- /* *
152
- * @brief Put the device in sleep mode for a specified amount of time. It restarts after waking up.
153
- * This function uses the default RTC instance to put the device in sleep mode and
154
- * does not call a function when the device wakes up.
155
- * @param hours The number of hours to sleep.
156
- * @param minutes The number of minutes to sleep.
157
- * @param seconds The number of seconds to sleep.
158
- * @return True if successful, false otherwise.
159
- */
160
- bool sleepFor (int hours, int minutes, int seconds);
161
-
162
- #if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4)
163
-
164
- /* *
165
- * Sleeps the board for a specified delay.
166
- *
167
- * @param delay The delay as an RTCWakeupDelay object.
168
- * @return True if the board successfully sleeps, false otherwise.
169
- */
170
- bool sleepFor (RTCWakeupDelay delay);
135
+ #if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4)
136
+ void enableWakeupFromRTC (uint32_t hours, uint32_t minutes, uint32_t seconds);
171
137
#endif
172
-
138
+
173
139
174
140
#if defined(ARDUINO_PORTENTA_C33)
175
- // TODO How to use this with the RTC? enableWakeupFromRTC(), then sleepFor, then this ?
141
+ // TODO Restarts after waking up. ?
176
142
/* *
177
143
* Put the device into sleep mode until a wakeup event occurs
178
144
* This sleep mode is ideal for applications requiring periodic wake-ups or
@@ -182,13 +148,13 @@ class Board {
182
148
* A wakeup event can be an interrupt on a pin or the RTC,
183
149
* depending on what you set with enableWakeupFromPin() and enableWakeupFromRTC().
184
150
*/
185
- void standByUntilWakeupEvent ();
151
+ void sleepUntilWakeupEvent ();
186
152
#endif
187
153
188
- // TODO Same as above
154
+ // TODO measurements are board specific. Need adjustments for Portenta H7.
189
155
/* *
190
- * Put the device into deep sleep mode until a wakeup event occurs.
191
- * For scenarios demanding drastic power conservation, the Deep Sleep Mode significantly reduces
156
+ * Put the device into standby mode until a wakeup event occurs.
157
+ * For scenarios demanding drastic power conservation, the standby Mode significantly reduces
192
158
* the board's power usage to range between 90uA and 11mA depending on the state of the peripherals.
193
159
* This mode restarts the board on wake-up, effectively running the setup() function again.
194
160
* A wakeup event can be an interrupt on a pin or the RTC, depending on what
@@ -208,14 +174,13 @@ class Board {
208
174
*/
209
175
void setCommunicationPeripheralsPower (bool on);
210
176
211
- #if defined(ARDUINO_PORTENTA_C33)
212
177
/* *
213
178
* @brief Toggles the power of the analog digital converter on Portenta C33.
179
+ * This is not available on the Portenta H7.
214
180
* @param on True to turn on the power, false to turn it off.
215
181
*/
216
182
void setAnalogDigitalConverterPower (bool on);
217
183
218
- #endif
219
184
/* *
220
185
* @brief Set the reference voltage. This value is used by the ADC to convert analog values to digital values.
221
186
* This can be particularly useful to increase the accuracy of the ADC when working with low voltages
@@ -235,10 +200,12 @@ class Board {
235
200
236
201
#if defined(ARDUINO_PORTENTA_C33)
237
202
LowPower * lowPower;
238
- #elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_NICLA_VISION)
239
- StandbyType standbyType = StandbyType::none;
240
- RTCWakeupDelay rtcWakeupDelay = RTCWakeupDelay(0 , 0 , 0 );
241
203
#endif
204
+
205
+ StandbyType standbyType = StandbyType::none;
206
+ uint32_t wakeupDelayHours;
207
+ uint32_t wakeupDelayMinutes;
208
+ uint32_t wakeupDelaySeconds;
242
209
};
243
210
244
211
#endif
0 commit comments