diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 06c91ef97..700905850 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs @@ -242,12 +242,12 @@ pub struct Config { #[cfg(dbgmcu)] pub enable_debug_during_sleep: bool, - /// On low-power boards (eg. `stm32l4`, `stm32l5` and `stm32u5`), + /// On low-power boards (eg. `stm32l4`, `stm32l5`, `stm32wba` and `stm32u5`), /// some GPIO pins are powered by an auxiliary, independent power supply (`VDDIO2`), /// which needs to be enabled before these pins can be used. /// /// May increase power consumption. Defaults to true. - #[cfg(any(stm32l4, stm32l5, stm32u5))] + #[cfg(any(stm32l4, stm32l5, stm32u5, stm32wba))] pub enable_independent_io_supply: bool, /// On the U5 series all analog peripherals are powered by a separate supply. @@ -291,7 +291,7 @@ impl Default for Config { rcc: Default::default(), #[cfg(dbgmcu)] enable_debug_during_sleep: true, - #[cfg(any(stm32l4, stm32l5, stm32u5))] + #[cfg(any(stm32l4, stm32l5, stm32u5, stm32wba))] enable_independent_io_supply: true, #[cfg(stm32u5)] enable_independent_analog_supply: true, @@ -540,6 +540,13 @@ fn init_hw(config: Config) -> Peripherals { w.set_iosv(config.enable_independent_io_supply); }); } + #[cfg(stm32wba)] + { + use crate::pac::pwr::vals; + crate::pac::PWR.svmcr().modify(|w| { + w.set_io2sv(vals::Io2sv::B_0X1); + }); + } #[cfg(stm32u5)] { crate::pac::PWR.svmcr().modify(|w| { diff --git a/embassy-stm32/src/low_power.rs b/embassy-stm32/src/low_power.rs index 7734365f1..4607eb230 100644 --- a/embassy-stm32/src/low_power.rs +++ b/embassy-stm32/src/low_power.rs @@ -124,10 +124,10 @@ pub enum StopMode { Stop2, } -#[cfg(any(stm32l4, stm32l5, stm32u5, stm32u0))] +#[cfg(any(stm32l4, stm32l5, stm32u5, stm32wba, stm32u0))] use stm32_metapac::pwr::vals::Lpms; -#[cfg(any(stm32l4, stm32l5, stm32u5, stm32u0))] +#[cfg(any(stm32l4, stm32l5, stm32u5, stm32wba, stm32u0))] impl Into for StopMode { fn into(self) -> Lpms { match self { @@ -198,7 +198,7 @@ impl Executor { #[allow(unused_variables)] fn configure_stop(&mut self, stop_mode: StopMode) { - #[cfg(any(stm32l4, stm32l5, stm32u5, stm32u0))] + #[cfg(any(stm32l4, stm32l5, stm32u5, stm32u0, stm32wba))] crate::pac::PWR.cr1().modify(|m| m.set_lpms(stop_mode.into())); #[cfg(stm32h5)] crate::pac::PWR.pmcr().modify(|v| {