From c27459c05251aada50b4de620b78d13dc071a765 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Fri, 8 Dec 2023 20:07:59 +0100 Subject: [PATCH] Update stm32-metapac. --- embassy-stm32/Cargo.toml | 4 ++-- embassy-stm32/build.rs | 4 ++++ embassy-stm32/src/adc/f1.rs | 2 +- embassy-stm32/src/can/mod.rs | 2 +- embassy-stm32/src/rcc/g4.rs | 2 ++ embassy-stm32/src/rcc/mod.rs | 4 ++-- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index 292902ac..c5877570 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml @@ -58,7 +58,7 @@ rand_core = "0.6.3" sdio-host = "0.5.0" embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "a4f293d3a6f72158385f79c98634cb8a14d0d2fc", optional = true } critical-section = "1.1" -stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-7117ad49c06fa00c388130a34977e029910083bd" } +stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-019a5da1c47c092c199bc39a7f84fb444f2adcdf" } vcell = "0.1.3" bxcan = "0.7.0" nb = "1.0.0" @@ -76,7 +76,7 @@ critical-section = { version = "1.1", features = ["std"] } [build-dependencies] proc-macro2 = "1.0.36" quote = "1.0.15" -stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-7117ad49c06fa00c388130a34977e029910083bd", default-features = false, features = ["metadata"]} +stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-019a5da1c47c092c199bc39a7f84fb444f2adcdf", default-features = false, features = ["metadata"]} [features] diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index 7bfd290d..0eef43ac 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs @@ -930,6 +930,10 @@ fn main() { } else if pin.signal.starts_with("INN") { // TODO handle in the future when embassy supports differential measurements None + } else if pin.signal.starts_with("IN") && pin.signal.ends_with("b") { + // we number STM32L1 ADC bank 1 as 0..=31, bank 2 as 32..=63 + let signal = pin.signal.strip_prefix("IN").unwrap().strip_suffix("b").unwrap(); + Some(32u8 + signal.parse::().unwrap()) } else if pin.signal.starts_with("IN") { Some(pin.signal.strip_prefix("IN").unwrap().parse().unwrap()) } else { diff --git a/embassy-stm32/src/adc/f1.rs b/embassy-stm32/src/adc/f1.rs index ad0f1382..fb27bb87 100644 --- a/embassy-stm32/src/adc/f1.rs +++ b/embassy-stm32/src/adc/f1.rs @@ -148,7 +148,7 @@ impl<'d, T: Instance> Adc<'d, T> { reg.set_cont(false); reg.set_exttrig(true); reg.set_swstart(false); - reg.set_extsel(crate::pac::adc::vals::Extsel::SWSTART); + reg.set_extsel(7); // SWSTART }); // Configure the channel to sample diff --git a/embassy-stm32/src/can/mod.rs b/embassy-stm32/src/can/mod.rs index 4ff5aa0d..425f9ac2 100644 --- a/embassy-stm32/src/can/mod.rs +++ b/embassy-stm32/src/can/mod.rs @@ -1,6 +1,6 @@ #![macro_use] #[cfg_attr(can_bxcan, path = "bxcan.rs")] -#[cfg_attr(can_fdcan, path = "fdcan.rs")] +#[cfg_attr(any(can_fdcan_v1, can_fdcan_h7), path = "fdcan.rs")] mod _version; pub use _version::*; diff --git a/embassy-stm32/src/rcc/g4.rs b/embassy-stm32/src/rcc/g4.rs index 48b27255..7af05b48 100644 --- a/embassy-stm32/src/rcc/g4.rs +++ b/embassy-stm32/src/rcc/g4.rs @@ -315,6 +315,8 @@ pub(crate) unsafe fn init(config: Config) { adc: adc12_ck, adc34: adc345_ck, pll1_p: None, + pll1_q: None, // TODO + hse: None, // TODO rtc, }); } diff --git a/embassy-stm32/src/rcc/mod.rs b/embassy-stm32/src/rcc/mod.rs index 2e144dc7..40a5a619 100644 --- a/embassy-stm32/src/rcc/mod.rs +++ b/embassy-stm32/src/rcc/mod.rs @@ -119,7 +119,7 @@ pub struct Clocks { #[cfg(any(stm32g4, rcc_l4))] pub pll1_p: Option, - #[cfg(any(stm32h5, stm32h7, rcc_f2, rcc_f4, rcc_f410, rcc_f7, rcc_l4))] + #[cfg(any(stm32h5, stm32h7, stm32f2, stm32f4, stm32f7, rcc_l4, stm32g4))] pub pll1_q: Option, #[cfg(any(stm32h5, stm32h7))] pub pll2_p: Option, @@ -167,7 +167,7 @@ pub struct Clocks { #[cfg(any(stm32h5, stm32h7, rcc_l4, rcc_c0))] pub lse: Option, - #[cfg(any(stm32h5, stm32h7))] + #[cfg(any(stm32h5, stm32h7, stm32g4))] pub hse: Option, #[cfg(stm32h5)]