Struct Transfer

Source
pub struct Transfer<Word: SupportedWordSize, I, P, Buffer, Rx: Target, Tx: Target, State> { /* private fields */ }
Expand description

A DMA transfer of the SPI peripheral

Since DMA can send and receive at the same time, using two DMA transfers and two DMA streams, we need this type to represent this operation and wrap the underlying dma::Transfer instances.

Implementations§

Source§

impl<Word, I, P, Buffer, Rx, Tx> Transfer<Word, I, P, Buffer, Rx, Tx, Ready>
where Rx: Target, Tx: Target, Word: SupportedWordSize,

Source

pub fn enable_interrupts( &mut self, rx_handle: &Handle<Rx::Instance, Enabled>, tx_handle: &Handle<Tx::Instance, Enabled>, interrupts: Interrupts, )

Enables the given interrupts for this DMA transfer

These interrupts are only enabled for this transfer. The settings doesn’t affect other transfers, nor subsequent transfers using the same DMA streams.

Source

pub fn start( self, rx_handle: &Handle<Rx::Instance, Enabled>, tx_handle: &Handle<Tx::Instance, Enabled>, ) -> Transfer<Word, I, P, Buffer, Rx, Tx, Started>

Start the DMA transfer

Consumes this instance of Transfer and returns another instance with its type state set to indicate the transfer has been started.

Source§

impl<Word, I, P, Buffer, Rx, Tx> Transfer<Word, I, P, Buffer, Rx, Tx, Started>
where Rx: Target, Tx: Target, Word: SupportedWordSize,

Source

pub fn is_active( &self, rx_handle: &Handle<Rx::Instance, Enabled>, tx_handle: &Handle<Tx::Instance, Enabled>, ) -> bool

Checks whether the transfer is still ongoing

Source

pub fn wait( self, rx_handle: &Handle<Rx::Instance, Enabled>, tx_handle: &Handle<Tx::Instance, Enabled>, ) -> WaitResult<Word, I, P, Rx, Tx, Buffer>

Waits for the transfer to end

This method will block if the transfer is still ongoing. If you want this method to return immediately, first check whether the transfer is still ongoing by calling is_active.

An ongoing transfer needs exlusive access to some resources, namely the data buffer, the DMA stream, and the peripheral. Those have been moved into the Transfer instance to prevent concurrent access to them. This method returns those resources, so they can be used again.

Auto Trait Implementations§

§

impl<Word, I, P, Buffer, Rx, Tx, State> Freeze for Transfer<Word, I, P, Buffer, Rx, Tx, State>
where State: Freeze, Buffer: Freeze, I: Freeze, P: Freeze, <Rx as Target>::Stream: Freeze, Rx: Freeze, <Tx as Target>::Stream: Freeze, Tx: Freeze,

§

impl<Word, I, P, Buffer, Rx, Tx, State> RefUnwindSafe for Transfer<Word, I, P, Buffer, Rx, Tx, State>

§

impl<Word, I, P, Buffer, Rx, Tx, State> !Send for Transfer<Word, I, P, Buffer, Rx, Tx, State>

§

impl<Word, I, P, Buffer, Rx, Tx, State> !Sync for Transfer<Word, I, P, Buffer, Rx, Tx, State>

§

impl<Word, I, P, Buffer, Rx, Tx, State> Unpin for Transfer<Word, I, P, Buffer, Rx, Tx, State>
where State: Unpin, Buffer: Unpin, I: Unpin, P: Unpin, <Rx as Target>::Stream: Unpin, Rx: Unpin, <Tx as Target>::Stream: Unpin, Tx: Unpin,

§

impl<Word, I, P, Buffer, Rx, Tx, State> UnwindSafe for Transfer<Word, I, P, Buffer, Rx, Tx, State>
where State: UnwindSafe, Buffer: UnwindSafe, I: UnwindSafe, P: UnwindSafe, <Rx as Target>::Stream: UnwindSafe, Rx: UnwindSafe, <Tx as Target>::Stream: UnwindSafe, Tx: UnwindSafe, Word: UnwindSafe + RefUnwindSafe,

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.