aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/time_driver.rs
diff options
context:
space:
mode:
authorBen Gamari <[email protected]>2023-10-30 13:36:52 -0400
committerBen Gamari <[email protected]>2023-10-30 14:36:08 -0400
commitaa97fe7cbd9e6b7dbb83b61133a38d436fb3efc0 (patch)
tree28a8b4b8fdbcc373d3d7ecf86d98faae8ee0418f /embassy-stm32/src/time_driver.rs
parentb6fc682117a41e8e63a9632e06da5a17f46d9ab0 (diff)
stm32: Add some documentation to `low_power`
This begins to explain the operation of the low-power executor.
Diffstat (limited to 'embassy-stm32/src/time_driver.rs')
-rw-r--r--embassy-stm32/src/time_driver.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/embassy-stm32/src/time_driver.rs b/embassy-stm32/src/time_driver.rs
index add8be831..564c9d086 100644
--- a/embassy-stm32/src/time_driver.rs
+++ b/embassy-stm32/src/time_driver.rs
@@ -346,6 +346,10 @@ impl RtcDriver {
346 } 346 }
347 347
348 #[cfg(feature = "low-power")] 348 #[cfg(feature = "low-power")]
349 /// The minimum pause time beyond which the executor will enter a low-power state.
350 pub(crate) const MIN_STOP_PAUSE: embassy_time::Duration = embassy_time::Duration::from_millis(250);
351
352 #[cfg(feature = "low-power")]
349 /// Pause the timer if ready; return err if not 353 /// Pause the timer if ready; return err if not
350 pub(crate) fn pause_time(&self) -> Result<(), ()> { 354 pub(crate) fn pause_time(&self) -> Result<(), ()> {
351 critical_section::with(|cs| { 355 critical_section::with(|cs| {
@@ -357,7 +361,7 @@ impl RtcDriver {
357 self.stop_wakeup_alarm(cs); 361 self.stop_wakeup_alarm(cs);
358 362
359 let time_until_next_alarm = self.time_until_next_alarm(cs); 363 let time_until_next_alarm = self.time_until_next_alarm(cs);
360 if time_until_next_alarm < embassy_time::Duration::from_millis(250) { 364 if time_until_next_alarm < Self::MIN_STOP_PAUSE {
361 Err(()) 365 Err(())
362 } else { 366 } else {
363 self.rtc 367 self.rtc