Skip to main content

Transfer

Struct Transfer 

Source
pub struct Transfer<const N: u8, P, BUF>
where Channel<N>: ChannelOps, P: DmaPeriph<N>,
{ /* private fields */ }
Expand description

A DMA transfer in progress, started by Channel::write_to or read_from.

Owns the channel, the peripheral and the buffer for as long as the transfer runs; wait is the only way to get them back.

Dropping instead of waiting stops the transfer and loses all three parts.

Implementations§

Source§

impl<const N: u8, P, BUF> Transfer<N, P, BUF>
where Channel<N>: ChannelOps, P: DmaPeriph<N>,

Source

pub fn wait(self) -> (Channel<N>, P, BUF)

Blocks until the transfer completes, then returns the channel, the peripheral and the buffer.

Does not check ERRIF: every address this API can hand a channel comes from a typed source, so a bus error is unreachable through safe code.

Source

pub fn remaining(&self) -> u16

How many transfers the channel has left, without waiting for it.

Counts transfers, not bytes: at Width::Bits16 a unit is two bytes on the wire. A snapshot only — the hardware keeps counting while the caller looks at it, so it serves progress reporting.

Source

pub fn is_error(&self) -> bool

Whether the channel has raised ERRIF, having hit a bus error.

Useful next to remaining to tell a stalled channel from a failed one.

Trait Implementations§

Source§

impl<const N: u8, P, BUF> Drop for Transfer<N, P, BUF>
where Channel<N>: ChannelOps, P: DmaPeriph<N>,

Source§

fn drop(&mut self)

Stops the transfer where it stands, without waiting for it to finish.

The tail of wait without the blocking: a running channel is cut off mid-buffer.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<const N: u8, P, BUF> Freeze for Transfer<N, P, BUF>
where Channel<N>: Freeze, P: Freeze, BUF: Freeze,

§

impl<const N: u8, P, BUF> RefUnwindSafe for Transfer<N, P, BUF>

§

impl<const N: u8, P, BUF> Send for Transfer<N, P, BUF>
where Channel<N>: Send, P: Send, BUF: Send,

§

impl<const N: u8, P, BUF> Sync for Transfer<N, P, BUF>
where Channel<N>: Sync, P: Sync, BUF: Sync,

§

impl<const N: u8, P, BUF> Unpin for Transfer<N, P, BUF>
where Channel<N>: Unpin, P: Unpin, BUF: Unpin,

§

impl<const N: u8, P, BUF> UnsafeUnpin for Transfer<N, P, BUF>

§

impl<const N: u8, P, BUF> UnwindSafe for Transfer<N, P, BUF>

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 = !

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

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

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.