pub struct Adc<'d, ADC, Dm: DriverMode> { /* private fields */ }Expand description
Analog-to-Digital Converter peripheral driver.
Implementations§
Source§impl<'d, ADCX> Adc<'d, ADCX, Blocking>where
ADCX: RegisterAccess + 'd,
impl<'d, ADCX> Adc<'d, ADCX, Blocking>where
ADCX: RegisterAccess + 'd,
Sourcepub fn new(adc_instance: ADCX, config: AdcConfig<ADCX>) -> Self
pub fn new(adc_instance: ADCX, config: AdcConfig<ADCX>) -> Self
Configure a given ADC instance using the provided configuration, and initialize the ADC for use
§Panics
ADC2 cannot be used simultaneously with radio functionalities, otherwise this function
will panic.
Sourcepub fn read_oneshot<PIN>(
&mut self,
pin: &mut AdcPin<PIN, ADCX>,
) -> Result<u16, ()>where
PIN: AdcChannel,
pub fn read_oneshot<PIN>(
&mut self,
pin: &mut AdcPin<PIN, ADCX>,
) -> Result<u16, ()>where
PIN: AdcChannel,
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.