Skip to content

Commit b1dda38

Browse files
committed
Update documentation based on review
1 parent d58339e commit b1dda38

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ In addition to the three Deep Sleep Locks already mentioned, additional locks ma
4343

4444
### 😴 Standby Mode
4545

46-
In Standby Mode, both the sketch and Mbed are entirely stopped by the library, and it asks the microcontroller to turn off almost all functionality to save power. You can wake it up from this mode in two ways: pulling the GPIO 0 pin low on the Portenta Breakout Board (no external pull-up resistor is necessary) or asking the library to wake up after a certain amount of time. The delay can be set anywhere from 1 second up to 36 hours, 24 minutes, and 32 seconds. When the board wakes up again, it's more or less in the same state as it would have been if you had pressed the reset button. You can ask the library what the board was doing before it woke up by calling `wasInCPUMode()`. More information on this can be found [here](./docs).
46+
In Standby Mode, both the sketch and Mbed are entirely stopped by the library, and it asks the microcontroller to turn off almost all functionality to save power. You can wake it up from this mode in two ways: pulling the GPIO 0 pin low on the Portenta Breakout Board (no external pull-up resistor is necessary) or asking the library to wake up after a certain amount of time. The delay can be set anywhere from 1 second up to 36 hours, 24 minutes, and 32 seconds. When the board wakes up again, it's more or less in the same state as it would have been if you had pressed the reset button. You can ask the library what the board was doing before it started by calling `wasInCPUMode()`. More information on this can be found [here](./docs).
4747

4848
## ⚖️ License
4949

docs/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ The only function necessary to enable automatic Deep Sleep Mode is `allowDeepSle
1818
### Standby Mode
1919

2020
To use Standby Mode, you need the following functions: `checkOptionBytes()`, `prepareOptionBytes()`, `standbyM7()`, and `standbyM4()`. The option byte functions are necessary to ensure that the flash option bytes in the microcontroller are correctly set for going into Standby Mode.
21-
Additionally, you can use `wasInCPUMode()` to check what the board was doing before it woke up:
22-
By passing one of the modes `d1Standby`, `d2Standby`, `standby` or `stop` as parameter you can determine in which of these modes the CPU was while it was in standby. It's possible that the CPU was in more than one of these modes so you need to check for each mode separately to get the complete picture.
21+
Additionally, you can use `wasInCPUMode()` to check what the board was doing before it started:
22+
By passing one of the modes `d1Standby`, `d2Standby`, `standby` or `stop` as parameter you can determine in which of these modes the CPU was before it started. It's possible that the CPU was in more than one of these modes so you need to check for each mode separately to get the complete picture.
2323
Only if `wasInCPUMode(CPUMode::standby)` returns true, Standby Mode was entered correctly. The other functions can be handy for troubleshooting. Remember to clear the mode flags by calling `resetPreviousCPUModeFlags()` when you are done checking them.
2424

2525
The microcontroller has three power domains: one for the M7 core (D1), one for the M4 core (D2), and a separate third domain (D3) for some other functionality. `wasInCPUMode(CPUMode::d1Standby)` returns true if D1 was in standby, but all three weren't at the same time, while `wasInCPUMode(CPUMode::d2Standby)()` returns true if D2 was in standby, but all three weren't at the same time. Both functions can return true simultaneously if D1 and D2 were in standby mode while D3 was still awake. When all three domains are in standby mode simultaneously, the microcontroller as a whole enters Standby Mode automatically, and `wasInCPUMode(CPUMode::standby)` returns true when it wakes up again. The `wasInCPUMode(CPUMode::stop)` function should never return true but can be helpful for further troubleshooting if you encounter any issues with this library.

examples/Standby/Standby.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* The microcontroller has three power domains: one for the M7 core (D1),
88
* one for the M4 core (D2), and a separate third domain (D3) for some other functionality.
99
* When all three domains are in standby mode simultaneously, the microcontroller as a whole
10-
* enters Standby Mode automatically, and `modeWasStandby()` only returns true when it wakes up again.
10+
* enters Standby Mode automatically, and `wasInCPUMode(CPUMode::standby)` returns true when it wakes up again.
1111
*
1212
* IMPORTANT: Upload the same sketch to both the M7 and the M4 core.
1313
*

src/Arduino_LowPowerPortentaH7.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ enum class LowPowerReturnCode
6767
*/
6868
enum class CPUMode
6969
{
70-
d1Standby, ///< Standby mode for the M7 core
71-
d2Standby, ///< Standby mode for the M4 core
70+
d1Standby, ///< Standby mode for the D1 domain
71+
d2Standby, ///< Standby mode for the D2 domain
7272
standby, ///< Standby mode for the whole microcontroller
7373
stop ///< Stop mode for the whole microcontroller
7474
};
@@ -287,19 +287,19 @@ class LowPowerPortentaH7 {
287287
LowPowerReturnCode checkOptionBytes() const;
288288

289289
/**
290-
* Checks if the microcontroller was in the given standby mode before waking up.
290+
* Checks if the microcontroller was in the given CPU mode before starting.
291291
* Note: It's possible that the microcontroller was in more than one of these modes
292-
* during standby. Call this function multiple times to check for each mode.
292+
* before starting. Call this function multiple times to check for each mode.
293293
* Important: When you're done checking, call resetStandbyModeFlags() to reset the flags
294-
* so they are reported correctly the next time the microcontroller wakes up.
294+
* so they are reported correctly the next time the microcontroller starts.
295295
* @param mode The CPU mode to check.
296296
* @return True if the microcontroller was in the given mode, false otherwise.
297297
*/
298298
bool wasInCPUMode(CPUMode mode) const;
299299

300300
/**
301301
* @brief Reset the flags that are used to determine the microcontroller's
302-
* previous standby mode. This is necessary to get correct results from
302+
* previous CPU mode. This is necessary to get correct results from
303303
* wasInCPUMode().
304304
*/
305305
void resetPreviousCPUModeFlags() const;

0 commit comments

Comments
 (0)