Struct Adc

Source
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,

Source

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

Source

pub fn into_async(self) -> Adc<'d, ADCI, Async>

Reconfigures the ADC driver to operate in asynchronous mode.

Source

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,

Source

pub fn into_blocking(self) -> Adc<'d, ADCI, Blocking>

Create a new instance in crate::Blocking mode.

Source

pub async fn read_oneshot<PIN, CS>( &mut self, pin: &mut AdcPin<PIN, ADCI, CS>, ) -> u16
where 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>

Source§

fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Registers an interrupt handler for the peripheral. Read more

Auto Trait Implementations§

§

impl<'d, ADCI, Dm> Freeze for Adc<'d, ADCI, Dm>
where ADCI: Freeze,

§

impl<'d, ADCI, Dm> RefUnwindSafe for Adc<'d, ADCI, Dm>
where ADCI: RefUnwindSafe, Dm: RefUnwindSafe,

§

impl<'d, ADCI, Dm> Send for Adc<'d, ADCI, Dm>
where ADCI: Send, Dm: Send,

§

impl<'d, ADCI, Dm> Sync for Adc<'d, ADCI, Dm>
where ADCI: Sync, Dm: Sync,

§

impl<'d, ADCI, Dm> Unpin for Adc<'d, ADCI, Dm>
where ADCI: Unpin, Dm: Unpin,

§

impl<'d, ADCI, Dm> !UnwindSafe for Adc<'d, ADCI, Dm>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.