embassy-mcxa

Crates

git

Versions

mcx-a256

Flavors

Adc

Struct Adc 

Source
pub struct Adc<'a, M: Mode> { /* private fields */ }
Expand description

ADC driver instance.

Implementations§

Source§

impl<'a> Adc<'a, Blocking>

Source

pub fn new_blocking<T: Instance>( _inst: Peri<'a, T>, commands: &'a [Command<'a, T>], triggers: &[Trigger], config: Config, ) -> Result<Self, Error>

Create a new blocking instance of the ADC

Source§

impl<'a> Adc<'a, Async>

Source

pub fn new_async<T: Instance>( _inst: Peri<'a, T>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'a, commands: &'a [Command<'a, T>], triggers: &[Trigger], config: Config, ) -> Result<Self, Error>

Create a new async instance of the ADC

Source

pub async fn wait_get_conversion(&mut self) -> Option<Conversion>

Reads the current conversion result from the fifo or waits for the next one if it’s pending.

If no conversion is pending, None is returned.

Source

pub async fn wait_conversion(&mut self) -> Conversion

Reads the current conversion result from the fifo or waits for the next one even if no conversion is currently pending.

If no conversion is pending, None is returned.

Source§

impl<'a, M: Mode> Adc<'a, M>

Source

pub fn do_software_trigger(&mut self, trigger_id_mask: u8) -> Result<(), Error>

Trigger ADC conversion(s) via software.

Initiates conversion(s) for the trigger(s) specified in the bitmask. Each bit in the mask corresponds to a trigger ID (bit 0 = trigger 0, etc.).

§Arguments
  • trigger_id_mask - Bitmask of trigger IDs to activate (bit N = trigger N)
§Returns
  • Ok(()) if the triger mask was valid
  • Error::NoTrigger if the mask is calling a trigger that’s not configured
Source

pub fn do_reset_fifo(&mut self)

Reset the FIFO buffer.

Clears all pending conversion results from the FIFO.

Source

pub fn try_get_conversion(&mut self) -> Result<Conversion, Error>

Get conversion result from FIFO.

Returns:

Source

pub fn do_offset_calibration(&mut self)

Perform offset calibration. Waits for calibration to complete before returning.

Source

pub fn do_auto_calibration(&mut self)

Perform automatic gain calibration.

Trait Implementations§

Source§

impl<'a, M: Mode> Drop for Adc<'a, M>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a, M> Freeze for Adc<'a, M>

§

impl<'a, M> !RefUnwindSafe for Adc<'a, M>

§

impl<'a, M> Send for Adc<'a, M>
where M: Send,

§

impl<'a, M> Sync for Adc<'a, M>
where M: Sync,

§

impl<'a, M> Unpin for Adc<'a, M>
where M: Unpin,

§

impl<'a, M> !UnwindSafe for Adc<'a, M>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.