From a33774ec5174d469639a63fe112907cd4e596fff Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Mon, 27 Mar 2023 12:36:31 +0200 Subject: [PATCH] Update stm32-metapac --- embassy-stm32/Cargo.toml | 4 ++-- embassy-stm32/src/adc/sample_time.rs | 13 ++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index b66d724d..14ec3d70 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml @@ -60,7 +60,7 @@ sdio-host = "0.5.0" embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "46d1b1c2ff13e31e282ec1e352421721694f126a", optional = true } critical-section = "1.1" atomic-polyfill = "1.0.1" -stm32-metapac = { version = "1", features = ["rt"] } +stm32-metapac = { version = "2", features = ["rt"] } vcell = "0.1.3" bxcan = "0.7.0" nb = "1.0.0" @@ -72,7 +72,7 @@ embedded-io = { version = "0.4.0", features = ["async"], optional = true } [build-dependencies] proc-macro2 = "1.0.36" quote = "1.0.15" -stm32-metapac = { version = "1", default-features = false, features = ["metadata"]} +stm32-metapac = { version = "2", default-features = false, features = ["metadata"]} [features] defmt = ["dep:defmt", "bxcan/unstable-defmt", "embassy-sync/defmt", "embassy-executor/defmt", "embassy-embedded-hal/defmt", "embassy-hal-common/defmt", "embedded-io?/defmt", "embassy-usb-driver?/defmt", "embassy-net-driver/defmt"] diff --git a/embassy-stm32/src/adc/sample_time.rs b/embassy-stm32/src/adc/sample_time.rs index 60ba8004..bc5fb1d6 100644 --- a/embassy-stm32/src/adc/sample_time.rs +++ b/embassy-stm32/src/adc/sample_time.rs @@ -1,5 +1,5 @@ macro_rules! impl_sample_time { - ($default_doc:expr, $default:ident, $pac:ty, ($(($doc:expr, $variant:ident, $pac_variant:ident)),*)) => { + ($default_doc:expr, $default:ident, ($(($doc:expr, $variant:ident, $pac_variant:ident)),*)) => { #[doc = concat!("ADC sample time\n\nThe default setting is ", $default_doc, " ADC clock cycles.")] #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)] pub enum SampleTime { @@ -9,10 +9,10 @@ macro_rules! impl_sample_time { )* } - impl From for $pac { - fn from(sample_time: SampleTime) -> $pac { + impl From for crate::pac::adc::vals::SampleTime { + fn from(sample_time: SampleTime) -> crate::pac::adc::vals::SampleTime { match sample_time { - $(SampleTime::$variant => <$pac>::$pac_variant),* + $(SampleTime::$variant => crate::pac::adc::vals::SampleTime::$pac_variant),* } } } @@ -29,7 +29,6 @@ macro_rules! impl_sample_time { impl_sample_time!( "1.5", Cycles1_5, - crate::pac::adc::vals::SampleTime, ( ("1.5", Cycles1_5, CYCLES1_5), ("7.5", Cycles7_5, CYCLES7_5), @@ -46,7 +45,6 @@ impl_sample_time!( impl_sample_time!( "3", Cycles3, - crate::pac::adc::vals::Smp, ( ("3", Cycles3, CYCLES3), ("15", Cycles15, CYCLES15), @@ -63,7 +61,6 @@ impl_sample_time!( impl_sample_time!( "2.5", Cycles2_5, - crate::pac::adc::vals::SampleTime, ( ("2.5", Cycles2_5, CYCLES2_5), ("6.5", Cycles6_5, CYCLES6_5), @@ -80,7 +77,6 @@ impl_sample_time!( impl_sample_time!( "1.5", Cycles1_5, - crate::pac::adc::vals::SampleTime, ( ("1.5", Cycles1_5, CYCLES1_5), ("3.5", Cycles3_5, CYCLES3_5), @@ -97,7 +93,6 @@ impl_sample_time!( impl_sample_time!( "1.5", Cycles1_5, - crate::pac::adc::vals::Smp, ( ("1.5", Cycles1_5, CYCLES1_5), ("2.5", Cycles2_5, CYCLES2_5),