Skip to content

Commit c02f480

Browse files
committed
Use clearer domain standby mode identifiers
1 parent b1dda38 commit c02f480

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Diff for: docs/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ The only function necessary to enable automatic Deep Sleep Mode is `allowDeepSle
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.
2121
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.
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.
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

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::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.
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.
2626

2727
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.
2828

Diff for: examples/Standby/Standby.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ void setup() {
8484
digitalWrite(LEDG, LOW);
8585
delay(2500);
8686
}
87-
if (LowPower.wasInCPUMode(CPUMode::d1Standby))
87+
if (LowPower.wasInCPUMode(CPUMode::d1DomainStandby))
8888
{
8989
digitalWrite(LEDB, LOW);
9090
digitalWrite(LEDR, HIGH);
9191
digitalWrite(LEDG, HIGH);
9292
delay(2500);
9393
}
94-
if (LowPower.wasInCPUMode(CPUMode::d2Standby))
94+
if (LowPower.wasInCPUMode(CPUMode::d2DomainStandby))
9595
{
9696
digitalWrite(LEDB, HIGH);
9797
digitalWrite(LEDR, LOW);

Diff for: src/Arduino_LowPowerPortentaH7.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ bool LowPowerPortentaH7::wasInCPUMode(CPUMode mode) const
216216

217217
switch (mode)
218218
{
219-
case CPUMode::d1Standby:
219+
case CPUMode::d1DomainStandby:
220220
return registerValue & PWR_CPUCR_SBF_D1;
221-
case CPUMode::d2Standby:
221+
case CPUMode::d2DomainStandby:
222222
return registerValue & PWR_CPUCR_SBF_D2;
223223
case CPUMode::standby:
224224
return registerValue & PWR_CPUCR_SBF;

Diff for: src/Arduino_LowPowerPortentaH7.h

+2-2
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 D1 domain
71-
d2Standby, ///< Standby mode for the D2 domain
70+
d1DomainStandby, ///< Standby mode for the D1 domain
71+
d2DomainStandby, ///< Standby mode for the D2 domain
7272
standby, ///< Standby mode for the whole microcontroller
7373
stop ///< Stop mode for the whole microcontroller
7474
};

0 commit comments

Comments
 (0)