stm32/adc: move convert resolution from PAC to version-specific mod.
This commit is contained in:
parent
35f16c6003
commit
881cb16d28
@ -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<T> {
|
||||
|
@ -48,22 +48,6 @@ impl From<Resolution> for crate::pac::adc::vals::Res {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<crate::pac::adc::vals::Res> 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 {
|
||||
|
Loading…
Reference in New Issue
Block a user