From 00aadf6085d080546ebbed91e2b1e2d6ecbbedea Mon Sep 17 00:00:00 2001 From: xoviat <xoviat@users.noreply.github.com> Date: Wed, 23 Aug 2023 20:22:11 -0500 Subject: [PATCH] stm32/lp: pipe through lp ready --- embassy-stm32/src/low_power.rs | 13 +++++-------- 1 file 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; use crate::interrupt; use crate::interrupt::typelevel::Interrupt; use crate::pac::EXTI; +use crate::rcc::low_power_ready; const THREAD_PENDER: usize = usize::MAX; const THRESHOLD: Duration = Duration::from_millis(500); @@ -73,22 +74,18 @@ impl Executor { cortex_m::asm::bkpt(); } - fn low_power_ready(&self) -> bool { - true - } - fn time_until_next_alarm(&self) -> Duration { Duration::from_secs(3) } - fn get_scb(&self) -> SCB { + fn get_scb() -> SCB { unsafe { cortex_m::Peripherals::steal() }.SCB } fn configure_pwr(&self) { - trace!("low power before wfe"); + trace!("configure_pwr"); - if !self.low_power_ready() { + if !low_power_ready() { return; } @@ -106,7 +103,7 @@ impl Executor { trace!("low power wait for rtc ready..."); - self.get_scb().set_sleepdeep(); + Self::get_scb().set_sleepdeep(); }); }