stm32: add low-power mod
This commit is contained in:
@@ -47,6 +47,8 @@ pub mod i2c;
|
||||
pub mod i2s;
|
||||
#[cfg(stm32wb)]
|
||||
pub mod ipcc;
|
||||
#[cfg(feature = "low-power")]
|
||||
pub mod low_power;
|
||||
#[cfg(quadspi)]
|
||||
pub mod qspi;
|
||||
#[cfg(rng)]
|
||||
|
15
embassy-stm32/src/low_power.rs
Normal file
15
embassy-stm32/src/low_power.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
use crate::rtc::{Rtc, RtcInstant};
|
||||
|
||||
static mut RTC: Option<&'static Rtc> = None;
|
||||
|
||||
pub fn stop_with_rtc(rtc: &'static Rtc) {
|
||||
unsafe { RTC = Some(rtc) };
|
||||
}
|
||||
|
||||
pub fn start_wakeup_alarm(requested_duration: embassy_time::Duration) -> RtcInstant {
|
||||
unsafe { RTC }.unwrap().start_wakeup_alarm(requested_duration)
|
||||
}
|
||||
|
||||
pub fn stop_wakeup_alarm() -> RtcInstant {
|
||||
unsafe { RTC }.unwrap().stop_wakeup_alarm()
|
||||
}
|
Reference in New Issue
Block a user