Skip to main content

Adc

Struct Adc 

Source
pub struct Adc<'d, ADCX, 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,

Source

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.

Source

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

Reconfigures the ADC driver to operate in asynchronous mode.

Source

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,

Source

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

Reconfigures the ADC driver to operate in Blocking mode.

Source

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

Trait Implementations§

Source§

impl<ADCX> InterruptConfigurable for Adc<'_, ADCX, Blocking>

Source§

fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Registers an interrupt handler for the peripheral. Read more

Auto Trait Implementations§

§

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

§

impl<'d, ADCX, Dm> Freeze for Adc<'d, ADCX, Dm>
where ADCX: Freeze, PhantomData<(Dm, &'d mut ())>: Freeze,

§

impl<'d, ADCX, Dm> RefUnwindSafe for Adc<'d, ADCX, Dm>
where ADCX: RefUnwindSafe, PhantomData<(Dm, &'d mut ())>: RefUnwindSafe,

§

impl<'d, ADCX, Dm> Send for Adc<'d, ADCX, Dm>
where ADCX: Send, PhantomData<(Dm, &'d mut ())>: Send,

§

impl<'d, ADCX, Dm> Sync for Adc<'d, ADCX, Dm>
where ADCX: Sync, PhantomData<(Dm, &'d mut ())>: Sync,

§

impl<'d, ADCX, Dm> Unpin for Adc<'d, ADCX, Dm>
where ADCX: Unpin, PhantomData<(Dm, &'d mut ())>: Unpin,

§

impl<'d, ADCX, Dm> UnsafeUnpin for Adc<'d, ADCX, Dm>
where ADCX: UnsafeUnpin, PhantomData<(Dm, &'d mut ())>: UnsafeUnpin,

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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.