mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-28 17:52:28 +00:00
Merge pull request #3213 from embedded-rust-iml/stm32l4-low-power
Implement low-power feature for STM32L4 MCUs
This commit is contained in:
commit
55c01818cf
@ -109,10 +109,10 @@ pub enum StopMode {
|
||||
Stop2,
|
||||
}
|
||||
|
||||
#[cfg(stm32l5)]
|
||||
#[cfg(any(stm32l4, stm32l5))]
|
||||
use stm32_metapac::pwr::vals::Lpms;
|
||||
|
||||
#[cfg(stm32l5)]
|
||||
#[cfg(any(stm32l4, stm32l5))]
|
||||
impl Into<Lpms> for StopMode {
|
||||
fn into(self) -> Lpms {
|
||||
match self {
|
||||
@ -181,7 +181,7 @@ impl Executor {
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn configure_stop(&mut self, stop_mode: StopMode) {
|
||||
#[cfg(stm32l5)]
|
||||
#[cfg(any(stm32l4, stm32l5))]
|
||||
crate::pac::PWR.cr1().modify(|m| m.set_lpms(stop_mode.into()));
|
||||
#[cfg(stm32h5)]
|
||||
crate::pac::PWR.pmcr().modify(|v| {
|
||||
|
@ -65,7 +65,7 @@ pub(crate) enum WakeupPrescaler {
|
||||
Div16 = 16,
|
||||
}
|
||||
|
||||
#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l5, stm32wb, stm32h5, stm32g0))]
|
||||
#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0))]
|
||||
impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel {
|
||||
fn from(val: WakeupPrescaler) -> Self {
|
||||
use crate::pac::rtc::vals::Wucksel;
|
||||
@ -79,7 +79,7 @@ impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l5, stm32wb, stm32h5, stm32g0))]
|
||||
#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0))]
|
||||
impl From<crate::pac::rtc::vals::Wucksel> for WakeupPrescaler {
|
||||
fn from(val: crate::pac::rtc::vals::Wucksel) -> Self {
|
||||
use crate::pac::rtc::vals::Wucksel;
|
||||
|
@ -131,10 +131,13 @@ impl SealedInstance for crate::peripherals::RTC {
|
||||
#[cfg(all(feature = "low-power", stm32f4))]
|
||||
const EXTI_WAKEUP_LINE: usize = 22;
|
||||
|
||||
#[cfg(all(feature = "low-power", stm32l4))]
|
||||
const EXTI_WAKEUP_LINE: usize = 20;
|
||||
|
||||
#[cfg(all(feature = "low-power", stm32l0))]
|
||||
const EXTI_WAKEUP_LINE: usize = 20;
|
||||
|
||||
#[cfg(all(feature = "low-power", stm32f4))]
|
||||
#[cfg(all(feature = "low-power", any(stm32f4, stm32l4)))]
|
||||
type WakeupInterrupt = crate::interrupt::typelevel::RTC_WKUP;
|
||||
|
||||
#[cfg(all(feature = "low-power", stm32l0))]
|
||||
|
Loading…
Reference in New Issue
Block a user