remove unnecessary mod

This commit is contained in:
Frederik 2022-02-12 23:55:58 +01:00
parent e4f240823d
commit 6f0488cbe7

View File

@ -71,45 +71,41 @@ impl<T: Instance> super::sealed::AdcPin<T> for Vbat {
} }
} }
mod sample_time { /// ADC sample time
/// ADC sample time ///
/// /// The default setting is 3 ADC clock cycles.
/// The default setting is 3 ADC clock cycles. #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)] pub enum SampleTime {
pub enum SampleTime { Cycles3 = 0b000,
Cycles3 = 0b000, Cycles15 = 0b001,
Cycles15 = 0b001, Cycles28 = 0b010,
Cycles28 = 0b010, Cycles56 = 0b011,
Cycles56 = 0b011, Cycles85 = 0b100,
Cycles85 = 0b100, Cycles112 = 0b101,
Cycles112 = 0b101, Cycles144 = 0b110,
Cycles144 = 0b110, Cycles480 = 0b111,
Cycles480 = 0b111, }
}
impl SampleTime { impl SampleTime {
pub(crate) fn sample_time(&self) -> crate::pac::adc::vals::Smp { pub(crate) fn sample_time(&self) -> crate::pac::adc::vals::Smp {
match self { match self {
SampleTime::Cycles3 => crate::pac::adc::vals::Smp::CYCLES3, SampleTime::Cycles3 => crate::pac::adc::vals::Smp::CYCLES3,
SampleTime::Cycles15 => crate::pac::adc::vals::Smp::CYCLES15, SampleTime::Cycles15 => crate::pac::adc::vals::Smp::CYCLES15,
SampleTime::Cycles28 => crate::pac::adc::vals::Smp::CYCLES28, SampleTime::Cycles28 => crate::pac::adc::vals::Smp::CYCLES28,
SampleTime::Cycles56 => crate::pac::adc::vals::Smp::CYCLES56, SampleTime::Cycles56 => crate::pac::adc::vals::Smp::CYCLES56,
SampleTime::Cycles85 => crate::pac::adc::vals::Smp::CYCLES84, SampleTime::Cycles85 => crate::pac::adc::vals::Smp::CYCLES84,
SampleTime::Cycles112 => crate::pac::adc::vals::Smp::CYCLES112, SampleTime::Cycles112 => crate::pac::adc::vals::Smp::CYCLES112,
SampleTime::Cycles144 => crate::pac::adc::vals::Smp::CYCLES144, SampleTime::Cycles144 => crate::pac::adc::vals::Smp::CYCLES144,
SampleTime::Cycles480 => crate::pac::adc::vals::Smp::CYCLES480, SampleTime::Cycles480 => crate::pac::adc::vals::Smp::CYCLES480,
}
}
}
impl Default for SampleTime {
fn default() -> Self {
Self::Cycles3
} }
} }
} }
pub use sample_time::SampleTime; impl Default for SampleTime {
fn default() -> Self {
Self::Cycles3
}
}
pub struct Adc<'d, T: Instance> { pub struct Adc<'d, T: Instance> {
sample_time: SampleTime, sample_time: SampleTime,