Merge pull request #4424 from leftger/fix/stm32wba-vddio

embassy-stm32: account for WBA devices and VDDIO2
This commit is contained in:
Dario Nieuwenhuis 2025-07-21 00:54:25 +02:00 committed by GitHub
commit a7c0985818
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 6 deletions

View File

@ -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| {

View File

@ -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<Lpms> 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| {