Skip to content

Commit 4f6733c

Browse files
committed
Add additional API documentation
1 parent e6bcee9 commit 4f6733c

File tree

1 file changed

+105
-1
lines changed

1 file changed

+105
-1
lines changed

src/Arduino_LowPowerPortentaH7.h

+105-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
********************************************************************************
3838
*/
3939

40+
/**
41+
* @enum LowPowerReturnCode
42+
* @brief Provides the return codes for the standby operations.
43+
* The codes indicate the success or failure of the operations.
44+
*/
4045
enum class LowPowerReturnCode
4146
{
4247
success, ///< The call was successful
@@ -60,19 +65,50 @@ enum class LowPowerReturnCode
6065
********************************************************************************
6166
*/
6267

68+
/**
69+
* @brief The LowPowerStandbyType class represents different types of standby modes for low power operation.
70+
*
71+
* This class provides options for standby modes: waiting until pin activity or until a specified time has elapsed.
72+
* It also allows to combine the two options.
73+
*/
6374
class LowPowerStandbyType {
6475
public:
76+
/**
77+
* @brief Class representing an activity that waits until a pin changes its state.
78+
*
79+
* This class provides functionality to wait until a specified pin changes its state,
80+
* either from LOW to HIGH or from HIGH to LOW.
81+
*/
6582
class UntilPinActivityClass {
6683
};
6784

85+
/**
86+
* @brief Represents a wakeup option which waits until a pin activity occurs.
87+
* This allows the microcontroller to wake up from standby through a pin interrupt
88+
* from a peripheral device.
89+
*/
6890
static const UntilPinActivityClass untilPinActivity;
6991

92+
/**
93+
* @brief A class representing a time elapsed condition.
94+
*
95+
* This class is used to specify a condition based on the elapsed time.
96+
* It is typically used in conjunction with the LowPower library for Arduino.
97+
*/
7098
class UntilTimeElapsedClass {
7199
};
72100

101+
/**
102+
* @brief Represents a wakeup option which waits until a specified time has elapsed.
103+
*/
73104
static const UntilTimeElapsedClass untilTimeElapsed;
74105

75106
private:
107+
108+
/**
109+
* @brief Represents a wakeup option which waits until either
110+
* a pin activity occurs or a specified time has elapsed.
111+
*/
76112
class UntilEitherClass {
77113
};
78114

@@ -85,6 +121,9 @@ class LowPowerStandbyType {
85121
const LowPowerStandbyType::UntilPinActivityClass& untilPinActivity);
86122
};
87123

124+
/**
125+
* @brief The RTCWakeupDelay class represents a delay before waking up from a low power mode.
126+
*/
88127
class RTCWakeupDelay {
89128
public:
90129
/**
@@ -104,6 +143,11 @@ class RTCWakeupDelay {
104143
// We don't really need this large type, but we must use this specific
105144
// type for user-defined literals to work.
106145
unsigned long long int value;
146+
147+
/**
148+
* @brief Private constructor to create a delay object with a specific delay value.
149+
* @param delay The delay value in seconds.
150+
*/
107151
RTCWakeupDelay(const unsigned long long int delay) : value(delay)
108152
{
109153
}
@@ -117,6 +161,20 @@ class RTCWakeupDelay {
117161
friend class LowPowerPortentaH7;
118162
};
119163

164+
/**
165+
* @class LowPowerPortentaH7
166+
* @brief A class that provides low power functionality for the Portenta H7 board.
167+
*
168+
* The LowPowerPortentaH7 class allows the microcontroller on the Portenta H7 board
169+
* to enter low power modes such as Standby Mode and Deep Sleep Mode. It provides
170+
* functions to check the current mode, prepare the option bytes for entering Standby Mode,
171+
* and control the M4 and M7 cores independently. It also provides functions to measure
172+
* the time since boot, time spent in idle, sleep, and deep sleep modes.
173+
*
174+
* This class is a singleton and can be accessed using the getInstance() function.
175+
*
176+
* @note This class is specific to the Portenta H7 board.
177+
*/
120178
class LowPowerPortentaH7 {
121179
private:
122180
LowPowerPortentaH7() = default;
@@ -168,11 +226,18 @@ class LowPowerPortentaH7 {
168226
}
169227

170228
public:
229+
/**
230+
* Returns the singleton instance of the LowPowerPortentaH7 class.
231+
* Due to the way the low power modes are configured, only one instance
232+
* of this class can exist at a time.
233+
*
234+
* @return The singleton instance of the LowPowerPortentaH7 class.
235+
*/
171236
static LowPowerPortentaH7& getInstance() noexcept {
172237
static LowPowerPortentaH7 instance;
173238
return instance;
174239
}
175-
240+
176241
/// @cond DEV
177242
LowPowerPortentaH7(const LowPowerPortentaH7&) = delete;
178243
LowPowerPortentaH7(LowPowerPortentaH7&&) = delete;
@@ -290,6 +355,9 @@ class LowPowerPortentaH7 {
290355
********************************************************************************
291356
*/
292357

358+
/**
359+
* @brief The global LowPower singleton object provides access to low power features of the Portenta H7 board.
360+
*/
293361
extern const LowPowerPortentaH7& LowPower;
294362

295363
/*
@@ -298,15 +366,51 @@ extern const LowPowerPortentaH7& LowPower;
298366
********************************************************************************
299367
*/
300368

369+
/**
370+
* @brief Literals operator to add multiple delays together. e.g. 5_s + 10_min + 2_h
371+
* @param d1 The first delay.
372+
* @param d2 The second delay.
373+
* @return The sum of the two delays.
374+
*/
301375
RTCWakeupDelay operator+(const RTCWakeupDelay d1, const RTCWakeupDelay d2);
376+
377+
/**
378+
* @brief Literals operator to create a delay in seconds.
379+
* @param seconds The number of seconds to wait before waking up.
380+
* @return The delay object.
381+
*/
302382
RTCWakeupDelay operator""_s(const unsigned long long int seconds);
383+
384+
/**
385+
* @brief Literals operator to create a delay in minutes.
386+
* @param minutes The number of minutes to wait before waking up.
387+
* @return The delay object.
388+
*/
303389
RTCWakeupDelay operator""_min(const unsigned long long int minutes);
304390

391+
/**
392+
* @brief Literals operator to create a delay in hours.
393+
* @param hours The number of hours to wait before waking up.
394+
* @return The delay object.
395+
*/
305396
RTCWakeupDelay operator""_h(const unsigned long long int hours);
397+
398+
/**
399+
* @brief Operator to combine two wakeup options.
400+
* @param untilPinActivity The pin activity wakeup option.
401+
* @param untilTimeElapsed The time elapsed wakeup option.
402+
* @return The combined wakeup option.
403+
*/
306404
LowPowerStandbyType::UntilEitherClass operator|(
307405
const LowPowerStandbyType::UntilPinActivityClass& untilPinActivity,
308406
const LowPowerStandbyType::UntilTimeElapsedClass& untilTimeElapsed);
309407

408+
/**
409+
* @brief Operator to combine two wakeup options.
410+
* @param untilTimeElapsed The time elapsed wakeup option.
411+
* @param untilPinActivity The pin activity wakeup option.
412+
* @return The combined wakeup option.
413+
*/
310414
LowPowerStandbyType::UntilEitherClass operator|(
311415
const LowPowerStandbyType::UntilTimeElapsedClass& untilTimeElapsed,
312416
const LowPowerStandbyType::UntilPinActivityClass& untilPinActivity);

0 commit comments

Comments
 (0)