pub struct Adc0Input { /* private fields */ }
Expand description

Represents data associated with ADC.

Implementations§

source§

impl Adc0Input

source

pub fn new( spi: Spi<SPI2, Enabled, u16>, trigger_stream: Stream0<DMA1>, data_stream: Stream1<DMA1>, clear_stream: Stream2<DMA1>, trigger_channel: Channel1, clear_channel: Channel1, batch_size: usize ) -> Self

Construct the ADC input channel.

§Args
  • spi - The SPI interface used to communicate with the ADC.
  • trigger_stream - The DMA stream used to trigger each ADC transfer by writing a word into the SPI TX FIFO.
  • data_stream - The DMA stream used to read samples received over SPI into a data buffer.
  • clear_stream - The DMA stream used to clear the EOT flag in the SPI peripheral.
  • trigger_channel - The ADC sampling timer output compare channel for read triggers.
  • clear_channel - The shadow sampling timer output compare channel used for clearing the SPI EOT flag.
source

pub fn start(&mut self)

Enable the ADC DMA transfer sequence.

source

pub fn with_buffer<F, R>(&mut self, f: F) -> Result<R, DMAError>
where F: FnOnce(&mut &'static mut [u16]) -> R,

Wait for the transfer of the currently active buffer to complete, then call a function on the now inactive buffer and acknowledge the transfer complete flag.

NOTE(unsafe): Memory safety and access ordering is not guaranteed (see the HAL DMA docs).

Trait Implementations§

source§

impl Mutex for Adc0Input

§

type Data = &'static mut [u16]

Data protected by the mutex.
source§

fn lock<R>(&mut self, f: impl FnOnce(&mut Self::Data) -> R) -> R

Creates a critical section and grants temporary access to the protected data.

Auto Trait Implementations§

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

§

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

§

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.