You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ In addition to the three Deep Sleep Locks already mentioned, additional locks ma
43
43
44
44
### 😴 Standby Mode
45
45
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 one or a combination of the functions: `modeWasD1Standby()`, `modeWasD2Standby()`, `modeWasStandby()`, and `modeWasStop()`.
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).
Copy file name to clipboardExpand all lines: docs/README.md
+5-2
Original file line number
Diff line number
Diff line change
@@ -17,9 +17,12 @@ The only function necessary to enable automatic Deep Sleep Mode is `allowDeepSle
17
17
18
18
### Standby Mode
19
19
20
-
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. Additionally, you can use the following functions to check what the board was doing before it started: `modeWasD1Standby()`, `modeWasD2Standby()`, `modeWasStandby()`, and `modeWasStop()`. Only `modeWasStandby()` should return true if Standby Mode was entered correctly. The other functions can be handy for troubleshooting. Remember to clear the mode flags by calling `resetPreviousMode()` when you are done checking them.
20
+
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 started:
22
+
By passing one of the modes `d1DomainStandby`, `d2DomainStandby`, `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.
23
+
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.
21
24
22
-
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. `modeWasD1Standby()` returns true if D1 was in standby, but all three weren't at the same time, while `modeWasD2Standby()` 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 only `modeWasStandby()` returns true when it wakes up again. The `modeWasStop()` function should never return true but can be helpful for further troubleshooting if you contact Arduino support.
25
+
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::d1DomainStandby)` returns true if D1 was in standby, but all three weren't at the same time, while `wasInCPUMode(CPUMode::d2DomainStandby)()` 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.
23
26
24
27
All configuration of Standby Mode is done when calling `standbyM7()`. It takes one or two parameters, depending on the conditions you want to set for waking up. The first parameter is one of the flags `LowPowerStandbyType::untilPinActivity` and `LowPowerStandbyType::untilTimeElapsed`. If you want to wake up from either type of event, you can combine the flags like so: `LowPowerStandbyType::untilPinActivity | LowPowerStandbyType::untilTimeElapsed`. If `LowPowerStandbyType::untilTimeElapsed` is present, the function takes a second parameter. This parameter's preferred format is `2_h + 30_min + 45_s`. You can use any combination of hours, minutes, and seconds. For example, `15_h`, or `1_h + 30_min`, or just `90_s`. If you first have to calculate the delay in your sketch, you can also pass something like this: `RTCWakeupDelay(1, 20, 30)`. The first number is hours, the second minutes, and the third seconds. But, the preferred option is to use _h, _min, and _s since that's more explicit.
Copy file name to clipboardExpand all lines: docs/api.md
+11-48
Original file line number
Diff line number
Diff line change
@@ -23,13 +23,10 @@ This class is specific to the Portenta H7 board.
23
23
|[`allowDeepSleep`](#class_low_power_portenta_h7_1a7ed518f8205a0b7306d23b7e2a22e82b)| Make Deep Sleep possible in the default case. |
24
24
|[`canDeepSleep`](#class_low_power_portenta_h7_1a07d9e0f356e40ac70655e279fbad87a9)| Check if Deep Sleep is possible or not at the moment. |
25
25
|[`checkOptionBytes`](#class_low_power_portenta_h7_1a7519d3acf693f450af84312576d8e669)| Check if the option bytes are correct to enter Standby Mode. |
26
-
|[`modeWasD1Standby`](#class_low_power_portenta_h7_1a4eb99fd03e8891f93d43aca4ea2329f9)| Check if the D1 domain was in Standby Mode or not. |
27
-
|[`modeWasD2Standby`](#class_low_power_portenta_h7_1a81e1c97f6411de6c6df390f7cb1ef8dc)| Check if the D2 domain was in Standby Mode or not. |
28
-
|[`modeWasStandby`](#class_low_power_portenta_h7_1afb2fc28d8a59bc34799e4c83a746f7c4)| Check if the whole microcontroller was in Standby Mode or not. |
29
-
|[`modeWasStop`](#class_low_power_portenta_h7_1a8420caa1148e61bc4d40e9627866afe3)| Check if the whole microcontroller was in Stop Mode or not. |
26
+
|[`wasInCPUMode`](#class_low_power_portenta_h7_1ae2059eb4fb01a30342b9fb6918b6ab4c)| Checks if the microcontroller was in the given standby mode before waking up. Note: It's possible that the microcontroller was in more than one of these modes during standby. Call this function multiple times to check for each mode. Important: When you're done checking, call resetStandbyModeFlags() to reset the flags so they are reported correctly the next time the microcontroller wakes up. |
27
+
|[`resetPreviousCPUModeFlags`](#class_low_power_portenta_h7_1a1753e3c053b2b64b59da3cbb9b921d76)| Reset the flags that are used to determine the microcontroller's previous standby mode. This is necessary to get correct results from [wasInCPUMode()](#class_low_power_portenta_h7_1ae2059eb4fb01a30342b9fb6918b6ab4c). |
30
28
|[`numberOfDeepSleepLocks`](#class_low_power_portenta_h7_1a9d2730d86abf42782261b0f03778c3bb)| Check how many Deep Sleep locks are held at the moment. |
31
29
|[`prepareOptionBytes`](#class_low_power_portenta_h7_1abdc0ce13b68d3a2188702690997af2ae)| Prepare the option bytes for entry into Standby Mode. |
32
-
|[`resetPreviousMode`](#class_low_power_portenta_h7_1a6f09b3ffe26355372f287ab90a451cc2)| Reset the flags behind the modeWas...() functions. |
33
30
|[`standbyM4`](#class_low_power_portenta_h7_1a9e07fd4f7895a7753e7e28f99aca1ace)| Make the M4 core enter Standby Mode. |
34
31
|[`standbyM7`](#class_low_power_portenta_h7_1a1eb5cec6e9604a48074f1c10ef5e7fb0)| Make the M7 core enter Standby Mode. |
35
32
|[`timeSinceBoot`](#class_low_power_portenta_h7_1a4758c25574b6d099545ac8d55eff6f68)| Time since the board was booted. It reports the time since the last wake-up reset (after standby) or power-on depending on what happened last. |
@@ -73,52 +70,28 @@ Check if the option bytes are correct to enter Standby Mode.
Check if the whole microcontroller was in Standby Mode or not.
79
+
Checks if the microcontroller was in the given standby mode before waking up. Note: It's possible that the microcontroller was in more than one of these modes during standby. Call this function multiple times to check for each mode. Important: When you're done checking, call resetStandbyModeFlags() to reset the flags so they are reported correctly the next time the microcontroller wakes up.
80
+
#### Parameters
81
+
* `mode` The CPU mode to check.
107
82
108
83
#### Returns
109
-
Was: true. Was not: false;
84
+
True if the microcontroller was in the given mode, false otherwise.
Check if the whole microcontroller was in Stop Mode or not.
93
+
Reset the flags that are used to determine the microcontroller's previous standby mode. This is necessary to get correct results from [wasInCPUMode()](#class_low_power_portenta_h7_1ae2059eb4fb01a30342b9fb6918b6ab4c).
0 commit comments