// PROTOTYPES SystemSleepConfiguration& duration(system_tick_t ms) SystemSleepConfiguration& duration(std::chrono::milliseconds ms) // EXAMPLE SystemSleepConfiguration config; config.mode(SystemSleepMode::HIBERNATE) .gpio(WKP, RISING) .duration(15min);
Specifies the sleep duration in milliseconds. Note that this is different than the classic API, which was in seconds.
You can also specify a value using chrono literals, for example:
.duration(15min) for 15 minutes.
Gen 3 Devices:
On the Argon, Boron, B Series SoM you cannot wake from HIBERNATE mode by time because the nRF52 RTC does not run in HIBERNATE mode. You can only wake by pin. The maximum duration is approximately 24 days in STOP mode. You can wake by time in ultra-low power (ULP) mode.
On the Tracker SoM, even though it has an nRF52 processor, you can wake from HIBERNATE by time as it uses the AM1805 external watchdog/RTC to implement this feature.
Gen 2 Devices:
On the Photon, P1, Electron, and E Series even though the parameter can be in milliseconds, the resolution is only in seconds, and the minimum sleep time is 1000 milliseconds.
On cellular devices, if you turn off the cellular modem, you should not wake with a period of less than 10 minutes on average. Your mobile carrier may ban your SIM card from the network for aggressive reconnection if you reconnect more than approximately 6 times per hour. You can wake your device frequently if you do not reconnect to cellular every time. For example, you can wake, sample a sensor and save the value, then go to sleep and only connect to cellular and upload the data every 10 minutes. Or you can use cellular standby so cellular stays connected through sleep cycles and then you can sleep for short durations.