pub struct Adc<'d, ADC, Dm: DriverMode> { /* private fields */ }
Available on crate feature
unstable
only.Expand description
Analog-to-Digital Converter peripheral driver.
Implementations§
Source§impl<'d, ADCI> Adc<'d, ADCI, Blocking>where
ADCI: RegisterAccess + 'd,
impl<'d, ADCI> Adc<'d, ADCI, Blocking>where
ADCI: RegisterAccess + 'd,
Sourcepub fn new(adc_instance: ADCI, config: AdcConfig<ADCI>) -> Self
pub fn new(adc_instance: ADCI, config: AdcConfig<ADCI>) -> Self
Configure a given ADC instance using the provided configuration, and initialize the ADC for use
Sourcepub fn read_blocking<PIN, CS>(&mut self, pin: &mut AdcPin<PIN, ADCI, CS>) -> u16where
PIN: AdcChannel,
CS: AdcCalScheme<ADCI>,
pub fn read_blocking<PIN, CS>(&mut self, pin: &mut AdcPin<PIN, ADCI, CS>) -> u16where
PIN: AdcChannel,
CS: AdcCalScheme<ADCI>,
Start and wait for a conversion on the specified pin and return the result
Sourcepub fn read_oneshot<PIN, CS>(
&mut self,
pin: &mut AdcPin<PIN, ADCI, CS>,
) -> Result<u16, ()>where
PIN: AdcChannel,
CS: AdcCalScheme<ADCI>,
pub fn read_oneshot<PIN, CS>(
&mut self,
pin: &mut AdcPin<PIN, ADCI, CS>,
) -> Result<u16, ()>where
PIN: AdcChannel,
CS: AdcCalScheme<ADCI>,
Request that the ADC begin a conversion on the specified pin
This method takes an AdcPin reference, as it is expected that the ADC will be able to sample whatever channel underlies the pin.