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, 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
Configures a given ADC instance using the provided configuration, and initializes the ADC for use.
Sourcepub fn into_async(self) -> Adc<'d, ADCX, Async>
pub fn into_async(self) -> Adc<'d, ADCX, Async>
Reconfigures the ADC driver to operate in asynchronous mode.
Sourcepub fn read_blocking<PIN, CS>(&mut self, pin: &mut AdcPin<PIN, ADCX, CS>) -> u16where
PIN: AdcChannel,
CS: AdcCalScheme<ADCX>,
pub fn read_blocking<PIN, CS>(&mut self, pin: &mut AdcPin<PIN, ADCX, CS>) -> u16where
PIN: AdcChannel,
CS: AdcCalScheme<ADCX>,
Starts and waits for a conversion on the specified pin and returns the result.
Sourcepub fn read_oneshot<PIN, CS>(
&mut self,
pin: &mut AdcPin<PIN, ADCX, CS>,
) -> Result<u16, ()>where
PIN: AdcChannel,
CS: AdcCalScheme<ADCX>,
pub fn read_oneshot<PIN, CS>(
&mut self,
pin: &mut AdcPin<PIN, ADCX, CS>,
) -> Result<u16, ()>where
PIN: AdcChannel,
CS: AdcCalScheme<ADCX>,
Requests that the ADC begin a conversion on the specified pin.
Takes an AdcPin reference, as it is
expected that the ADC will be able to sample whatever channel
underlies the pin.
Source§impl<'d, ADCX> Adc<'d, ADCX, Async>where
ADCX: RegisterAccess + 'd,
impl<'d, ADCX> Adc<'d, ADCX, Async>where
ADCX: RegisterAccess + 'd,
Sourcepub fn into_blocking(self) -> Adc<'d, ADCX, Blocking>
pub fn into_blocking(self) -> Adc<'d, ADCX, Blocking>
Reconfigures the ADC driver to operate in Blocking mode.
Sourcepub async fn read_oneshot<PIN, CS>(
&mut self,
pin: &mut AdcPin<PIN, ADCX, CS>,
) -> u16
pub async fn read_oneshot<PIN, CS>( &mut self, pin: &mut AdcPin<PIN, ADCX, CS>, ) -> u16
Starts a conversion on the specified pin and waits until it completes.
Takes an AdcPin reference, as it is expected that the
ADC will be able to sample whatever channel underlies the pin.
Trait Implementations§
Source§impl<ADCX> InterruptConfigurable for Adc<'_, ADCX, Blocking>
impl<ADCX> InterruptConfigurable for Adc<'_, ADCX, Blocking>
Source§fn set_interrupt_handler(&mut self, handler: InterruptHandler)
fn set_interrupt_handler(&mut self, handler: InterruptHandler)
Registers an interrupt handler for the peripheral on the current core. Read more