stm32/adc: Remove voltage and temperature conversions

This commit is contained in:
Grant Miller
2022-10-23 16:31:10 -05:00
parent ce1cba761c
commit 545cc9326b
7 changed files with 45 additions and 103 deletions

View File

@ -314,7 +314,6 @@ impl Prescaler {
pub struct Adc<'d, T: Instance> {
sample_time: SampleTime,
vref_mv: u32,
resolution: Resolution,
phantom: PhantomData<&'d mut T>,
}
@ -352,7 +351,6 @@ impl<'d, T: Instance + crate::rcc::RccPeripheral> Adc<'d, T> {
let mut s = Self {
sample_time: Default::default(),
vref_mv: VREF_DEFAULT_MV,
resolution: Resolution::default(),
phantom: PhantomData,
};
@ -459,18 +457,6 @@ impl<'d, T: Instance + crate::rcc::RccPeripheral> Adc<'d, T> {
self.resolution = resolution;
}
/// Set VREF value in millivolts. This value is used for [to_millivolts()] sample conversion.
///
/// Use this if you have a known precise VREF (VDDA) pin reference voltage.
pub fn set_vref_mv(&mut self, vref_mv: u32) {
self.vref_mv = vref_mv;
}
/// Convert a measurement to millivolts
pub fn to_millivolts(&self, sample: u16) -> u16 {
((u32::from(sample) * self.vref_mv) / self.resolution.to_max_count()) as u16
}
/// Perform a single conversion.
fn convert(&mut self) -> u16 {
unsafe {