pub struct Adc<'d, T: Instance> { /* private fields */ }
Expand description
Analog to Digital driver.
Implementations§
Source§impl<'d, T: Instance> Adc<'d, T>
impl<'d, T: Instance> Adc<'d, T>
Sourcepub fn new(adc: impl Peripheral<P = T> + 'd) -> Self
pub fn new(adc: impl Peripheral<P = T> + 'd) -> Self
Create a new ADC driver.
Sourcepub fn enable_vrefint(&self) -> VrefInt
pub fn enable_vrefint(&self) -> VrefInt
Enable reading the voltage reference internal channel.
Sourcepub fn enable_temperature(&self) -> Temperature
pub fn enable_temperature(&self) -> Temperature
Enable reading the temperature internal channel.
Sourcepub fn enable_vbat(&self) -> Vbat
pub fn enable_vbat(&self) -> Vbat
Enable reading the vbat internal channel.
Sourcepub fn set_differential_channel(&mut self, ch: usize, enable: bool)
pub fn set_differential_channel(&mut self, ch: usize, enable: bool)
Enable differential channel. Caution: : When configuring the channel “i” in differential input mode, its negative input voltage VINN[i] is connected to another channel. As a consequence, this channel is no longer usable in single-ended mode or in differential mode and must never be configured to be converted. Some channels are shared between ADC1/ADC2/ADC3/ADC4/ADC5: this can make the channel on the other ADC unusable. The only exception is when ADC master and the slave operate in interleaved mode.
pub fn set_differential( &mut self, channel: &mut impl AdcChannel<T>, enable: bool, )
Sourcepub fn set_oversampling_shift(&mut self, shift: u8)
pub fn set_oversampling_shift(&mut self, shift: u8)
Set oversampling shift.
Sourcepub fn set_oversampling_ratio(&mut self, ratio: u8)
pub fn set_oversampling_ratio(&mut self, ratio: u8)
Set oversampling ratio.
Sourcepub fn enable_regular_oversampling_mode(
&mut self,
mode: Rovsm,
trig_mode: Trovs,
enable: bool,
)
pub fn enable_regular_oversampling_mode( &mut self, mode: Rovsm, trig_mode: Trovs, enable: bool, )
Enable oversampling in regular mode.
Sourcepub fn set_sample_time(&mut self, sample_time: SampleTime)
pub fn set_sample_time(&mut self, sample_time: SampleTime)
Set the ADC sample time.
Sourcepub fn set_resolution(&mut self, resolution: Resolution)
pub fn set_resolution(&mut self, resolution: Resolution)
Set the ADC resolution.
Sourcepub fn blocking_read(&mut self, channel: &mut impl AdcChannel<T>) -> u16
pub fn blocking_read(&mut self, channel: &mut impl AdcChannel<T>) -> u16
Read an ADC pin.