pub struct Adc<'d, ADCI, 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: impl Peripheral<P = ADCI> + 'd,
config: AdcConfig<ADCI>,
) -> Self
pub fn new( adc_instance: impl Peripheral<P = ADCI> + 'd, config: AdcConfig<ADCI>, ) -> Self
Configure a given ADC instance using the provided configuration, and initialize the ADC for use
Sourcepub fn into_async(self) -> Adc<'d, ADCI, Async>
pub fn into_async(self) -> Adc<'d, ADCI, Async>
Reconfigures the ADC driver to operate in asynchronous mode.
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.
Source§impl<'d, ADCI> Adc<'d, ADCI, Async>where
ADCI: RegisterAccess + 'd,
impl<'d, ADCI> Adc<'d, ADCI, Async>where
ADCI: RegisterAccess + 'd,
Sourcepub fn into_blocking(self) -> Adc<'d, ADCI, Blocking>
pub fn into_blocking(self) -> Adc<'d, ADCI, Blocking>
Create a new instance in crate::Blocking mode.
Sourcepub async fn read_oneshot<PIN, CS>(
&mut self,
pin: &mut AdcPin<PIN, ADCI, CS>,
) -> u16where
ADCI: AsyncAccess,
PIN: AdcChannel,
CS: AdcCalScheme<ADCI>,
pub async fn read_oneshot<PIN, CS>(
&mut self,
pin: &mut AdcPin<PIN, ADCI, CS>,
) -> u16where
ADCI: AsyncAccess,
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.
Trait Implementations§
Source§impl<ADCI> InterruptConfigurable for Adc<'_, ADCI, Blocking>
impl<ADCI> InterruptConfigurable for Adc<'_, ADCI, 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. Read more