Struct stm32l4xx_hal::adc::ADC
source · [−]pub struct ADC { /* private fields */ }
Expand description
Analog to Digital converter interface
Implementations
sourceimpl ADC
impl ADC
sourcepub fn new(
adc: ADC1,
common: ADC_COMMON,
ahb: &mut AHB2,
ccipr: &mut CCIPR,
delay: &mut impl DelayUs<u32>
) -> Self
pub fn new(
adc: ADC1,
common: ADC_COMMON,
ahb: &mut AHB2,
ccipr: &mut CCIPR,
delay: &mut impl DelayUs<u32>
) -> Self
Initialize the ADC
sourcepub fn enable_vref(&mut self, delay: &mut impl DelayUs<u32>) -> Vref
pub fn enable_vref(&mut self, delay: &mut impl DelayUs<u32>) -> Vref
Enable and get the Vref
sourcepub fn enable_temperature(
&mut self,
delay: &mut impl DelayUs<u32>
) -> Temperature
pub fn enable_temperature(
&mut self,
delay: &mut impl DelayUs<u32>
) -> Temperature
Enable and get the Temperature
sourcepub fn enable_vbat(&mut self) -> Vbat
pub fn enable_vbat(&mut self) -> Vbat
Enable and get the Vbat
sourcepub fn calibrate(&mut self, vref: &mut Vref)
pub fn calibrate(&mut self, vref: &mut Vref)
Calculates the system VDDA by sampling the internal VREF channel and comparing the result with the value stored at the factory. If the chip’s VDDA is not stable, run this before each ADC conversion.
sourcepub fn set_resolution(&mut self, resolution: Resolution)
pub fn set_resolution(&mut self, resolution: Resolution)
Set the ADC resolution
sourcepub fn set_sample_time(&mut self, sample_time: SampleTime)
pub fn set_sample_time(&mut self, sample_time: SampleTime)
Set the sample time
sourcepub fn get_max_value(&self) -> u16
pub fn get_max_value(&self) -> u16
Get the max value for the current resolution
sourcepub fn release(self) -> (ADC1, ADC_COMMON)
pub fn release(self) -> (ADC1, ADC_COMMON)
Release the ADC peripheral
Drops ADC
and returns the (pac::ADC, pad::ADC_COMMON)
that is was wrapping, giving the
user full access to the peripheral.
sourcepub fn to_millivolts(&self, sample: u16) -> u16
pub fn to_millivolts(&self, sample: u16) -> u16
Convert a measurement to millivolts
sourcepub fn to_degrees_centigrade(&self, sample: u16) -> f32
pub fn to_degrees_centigrade(&self, sample: u16) -> f32
Convert a raw sample from the Temperature
to deg C
pub fn get_data(&self) -> u16
sourcepub fn configure_sequence<C>(
&mut self,
channel: &mut C,
sequence: Sequence,
sample_time: SampleTime
) where
C: Channel,
pub fn configure_sequence<C>(
&mut self,
channel: &mut C,
sequence: Sequence,
sample_time: SampleTime
) where
C: Channel,
Configure the channel for a specific step in the sequence.
Automatically sets the sequence length to the farthes sequence
index that has been used so far. Use ADC::reset_sequence
to
reset the sequence length.
sourcepub fn reset_sequence(&mut self)
pub fn reset_sequence(&mut self)
Reset the sequence length to 1
Does not erase previously configured sequence settings, only changes the sequence length
pub fn has_completed_conversion(&self) -> bool
pub fn has_completed_sequence(&self) -> bool
pub fn clear_end_flags(&mut self)
pub fn start_conversion(&mut self)
pub fn is_converting(&self) -> bool
pub fn listen(&mut self, event: Event)
pub fn unlisten(&mut self, event: Event)
pub fn enable(&mut self)
pub fn is_enabled(&self) -> bool
pub fn disable(&mut self)
Trait Implementations
sourceimpl Channel<ADC> for Temperature
impl Channel<ADC> for Temperature
Auto Trait Implementations
impl RefUnwindSafe for ADC
impl Send for ADC
impl !Sync for ADC
impl Unpin for ADC
impl UnwindSafe for ADC
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more