diff --git a/embassy-stm32/src/adc/f3_v1_1.rs b/embassy-stm32/src/adc/f3_v1_1.rs index 0bbfd3137..6915a8f1c 100644 --- a/embassy-stm32/src/adc/f3_v1_1.rs +++ b/embassy-stm32/src/adc/f3_v1_1.rs @@ -175,7 +175,12 @@ impl<'d, T: Instance> Adc<'d, T> { } pub fn resolution(&self) -> Resolution { - T::regs().cr1().read().res().into() + match T::regs().cr1().read().res() { + crate::pac::adc::vals::Res::TWELVEBIT => Resolution::TwelveBit, + crate::pac::adc::vals::Res::TENBIT => Resolution::TenBit, + crate::pac::adc::vals::Res::EIGHTBIT => Resolution::EightBit, + crate::pac::adc::vals::Res::SIXBIT => Resolution::SixBit, + } } pub fn enable_vref(&self) -> Vref { diff --git a/embassy-stm32/src/adc/resolution.rs b/embassy-stm32/src/adc/resolution.rs index b1597a821..383980b5a 100644 --- a/embassy-stm32/src/adc/resolution.rs +++ b/embassy-stm32/src/adc/resolution.rs @@ -48,22 +48,6 @@ impl From for crate::pac::adc::vals::Res { } } -impl From for Resolution { - fn from(res: crate::pac::adc::vals::Res) -> Resolution { - match res { - #[cfg(adc_v4)] - crate::pac::adc::vals::Res::SIXTEENBIT => Resolution::SixteenBit, - #[cfg(adc_v4)] - crate::pac::adc::vals::Res::FOURTEENBITV => Resolution::FourteenBit, - crate::pac::adc::vals::Res::TWELVEBIT => Resolution::TwelveBit, - crate::pac::adc::vals::Res::TENBIT => Resolution::TenBit, - crate::pac::adc::vals::Res::EIGHTBIT => Resolution::EightBit, - #[cfg(any(adc_v1, adc_v2, adc_v3, adc_g0, adc_f3, adc_f3_v1_1, adc_f3_v3))] - crate::pac::adc::vals::Res::SIXBIT => Resolution::SixBit, - } - } -} - impl Resolution { pub fn to_max_count(&self) -> u32 { match self {