pub struct Adc { /* private fields */ }
Expand description
Analog to Digital converter interface
Implementations§
Source§impl Adc
impl Adc
Sourcepub fn new(adc: ADC, rcc: &mut Rcc) -> Self
pub fn new(adc: ADC, rcc: &mut Rcc) -> Self
Init a new Adc
Sets all configurable parameters to defaults, enables the HSI14 clock for the ADC if it is not already enabled and performs a boot time calibration. As such this method may take an appreciable time to run.
Sourcepub fn save_cfg(&mut self) -> StoredConfig
pub fn save_cfg(&mut self) -> StoredConfig
Saves a copy of the current ADC config
Sourcepub fn restore_cfg(&mut self, cfg: StoredConfig)
pub fn restore_cfg(&mut self, cfg: StoredConfig)
Restores a stored config
Sourcepub fn default_cfg(&mut self) -> StoredConfig
pub fn default_cfg(&mut self) -> StoredConfig
Resets the ADC config to default, returning the existing config as a stored config.
Sourcepub fn set_sample_time(&mut self, t_samp: AdcSampleTime)
pub fn set_sample_time(&mut self, t_samp: AdcSampleTime)
Set the Adc sampling time
Options can be found in AdcSampleTime.
Sourcepub fn set_align(&mut self, align: AdcAlign)
pub fn set_align(&mut self, align: AdcAlign)
Set the Adc result alignment
Options can be found in AdcAlign.
Sourcepub fn set_precision(&mut self, precision: AdcPrecision)
pub fn set_precision(&mut self, precision: AdcPrecision)
Set the Adc precision
Options can be found in AdcPrecision.
Sourcepub fn max_sample(&self) -> u16
pub fn max_sample(&self) -> u16
Returns the largest possible sample value for the current settings
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Adc
impl RefUnwindSafe for Adc
impl Send for Adc
impl !Sync for Adc
impl Unpin for Adc
impl UnwindSafe for Adc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more