diff options
| author | xoviat <[email protected]> | 2023-08-23 20:22:11 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-08-23 20:22:11 -0500 |
| commit | 00aadf6085d080546ebbed91e2b1e2d6ecbbedea (patch) | |
| tree | 48e958f06c9fa8e093e0dd9a9db108c72086619a /embassy-stm32/src/low_power.rs | |
| parent | 83f224e14094488244792dc1bc6d7425d8dcd68f (diff) | |
stm32/lp: pipe through lp ready
Diffstat (limited to 'embassy-stm32/src/low_power.rs')
| -rw-r--r-- | embassy-stm32/src/low_power.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/embassy-stm32/src/low_power.rs b/embassy-stm32/src/low_power.rs index f4bf7bbea..7814fa384 100644 --- a/embassy-stm32/src/low_power.rs +++ b/embassy-stm32/src/low_power.rs | |||
| @@ -8,6 +8,7 @@ use embassy_time::Duration; | |||
| 8 | use crate::interrupt; | 8 | use crate::interrupt; |
| 9 | use crate::interrupt::typelevel::Interrupt; | 9 | use crate::interrupt::typelevel::Interrupt; |
| 10 | use crate::pac::EXTI; | 10 | use crate::pac::EXTI; |
| 11 | use crate::rcc::low_power_ready; | ||
| 11 | 12 | ||
| 12 | const THREAD_PENDER: usize = usize::MAX; | 13 | const THREAD_PENDER: usize = usize::MAX; |
| 13 | const THRESHOLD: Duration = Duration::from_millis(500); | 14 | const THRESHOLD: Duration = Duration::from_millis(500); |
| @@ -73,22 +74,18 @@ impl Executor { | |||
| 73 | cortex_m::asm::bkpt(); | 74 | cortex_m::asm::bkpt(); |
| 74 | } | 75 | } |
| 75 | 76 | ||
| 76 | fn low_power_ready(&self) -> bool { | ||
| 77 | true | ||
| 78 | } | ||
| 79 | |||
| 80 | fn time_until_next_alarm(&self) -> Duration { | 77 | fn time_until_next_alarm(&self) -> Duration { |
| 81 | Duration::from_secs(3) | 78 | Duration::from_secs(3) |
| 82 | } | 79 | } |
| 83 | 80 | ||
| 84 | fn get_scb(&self) -> SCB { | 81 | fn get_scb() -> SCB { |
| 85 | unsafe { cortex_m::Peripherals::steal() }.SCB | 82 | unsafe { cortex_m::Peripherals::steal() }.SCB |
| 86 | } | 83 | } |
| 87 | 84 | ||
| 88 | fn configure_pwr(&self) { | 85 | fn configure_pwr(&self) { |
| 89 | trace!("low power before wfe"); | 86 | trace!("configure_pwr"); |
| 90 | 87 | ||
| 91 | if !self.low_power_ready() { | 88 | if !low_power_ready() { |
| 92 | return; | 89 | return; |
| 93 | } | 90 | } |
| 94 | 91 | ||
| @@ -106,7 +103,7 @@ impl Executor { | |||
| 106 | 103 | ||
| 107 | trace!("low power wait for rtc ready..."); | 104 | trace!("low power wait for rtc ready..."); |
| 108 | 105 | ||
| 109 | self.get_scb().set_sleepdeep(); | 106 | Self::get_scb().set_sleepdeep(); |
| 110 | }); | 107 | }); |
| 111 | } | 108 | } |
| 112 | 109 | ||
