Transfer

Struct Transfer 

Source
pub struct Transfer<State, C, S, D>
where C: Instance,
{ /* private fields */ }
Expand description

A DMA transfer

A Transfer instance is used to represent a DMA transfer that uses a specific Channel. Instances of this can be acquired by calling a write_all or read_all method of the peripheral that should be involved in the transfer.

§Limitations

Currently, memory-to-memory transfers are not supported. If you need this features, feel free to comment on the respective GitHub issue.

Implementations§

Source§

impl<C, S, D> Transfer<Ready, C, S, D>
where C: Instance, S: Source, D: Dest,

Source

pub fn set_a_when_complete(&mut self)

Set INTA flag when this transfer is complete

By default, the flag is not set. This method can be used to overwrite that setting. Setting the flag can be used to trigger an interrupt.

This method is only available, if the Transfer is in the Ready state. Code attempting to call this method when this is not the case will not compile.

Source

pub fn set_b_when_complete(&mut self)

Set INTB flag when this transfer is complete

By default, the flag is not set. This method can be used to overwrite that setting. Setting the flag can be used to trigger an interrupt.

This method is only available, if the Transfer is in the Ready state. Code attempting to call this method when this is not the case will not compile.

Source

pub fn start(self) -> Transfer<Started, C, S, D>

Start the DMA transfer

This method is only available, if the Transfer is in the Ready state. Code attempting to call this method when this is not the case will not compile.

Consumes this Transfer instance and returns another one with its State parameter set to Started.

Source§

impl<C, S, D> Transfer<Started, C, S, D>
where C: Instance, S: Source, D: Dest,

Source

pub fn is_active(&self) -> bool

Indicates whether transfer is currently active

Corresponds to the channel’s flag in the ACTIVE0 register.

This method is only available, if the Transfer is in the Started state. Code attempting to call this method when this is not the case will not compile.

Source

pub fn is_busy(&self) -> bool

Indicates whether transfer is currently busy

Corresponds to the channel’s flag in the BUSY0 register.

This method is only available, if the Transfer is in the Started state. Code attempting to call this method when this is not the case will not compile.

Source

pub fn error_interrupt_fired(&self) -> bool

Indicates whether the error interrupt fired

Corresponds to the channel’s flag in the ERRINT0 register.

This method is only available, if the Transfer is in the Started state. Code attempting to call this method when this is not the case will not compile.

Source

pub fn a_interrupt_fired(&self) -> bool

Indicates whether interrupt A fired

Corresponds to the channel’s flag in the INTA0 register.

This method is only available, if the Transfer is in the Started state. Code attempting to call this method when this is not the case will not compile.

Source

pub fn b_interrupt_fired(&self) -> bool

Indicates whether interrupt B fired

Corresponds to the channel’s flag in the INTB0 register.

This method is only available, if the Transfer is in the Started state. Code attempting to call this method when this is not the case will not compile.

Source

pub fn wait( self, ) -> Result<Payload<C, S, D>, (Error<S::Error, D::Error>, Payload<C, S, D>)>

Waits for the transfer to finish

This method will block until the transfer is finished. If this is not acceptable, you can enable an interrupt for the channel, and/or check the channel state with the is_active method.

This method is only available, if the Transfer is in the Started state. Code attempting to call this method when this is not the case will not compile.

Consumes this instance of Transfer and returns the transfer payload, which contains all resources that were held by this transfer.

Auto Trait Implementations§

§

impl<State, C, S, D> Freeze for Transfer<State, C, S, D>
where State: Freeze, S: Freeze, D: Freeze, C: Freeze,

§

impl<State, C, S, D> RefUnwindSafe for Transfer<State, C, S, D>

§

impl<State, C, S, D> Send for Transfer<State, C, S, D>
where State: Send, S: Send, D: Send, C: Send,

§

impl<State, C, S, D> !Sync for Transfer<State, C, S, D>

§

impl<State, C, S, D> Unpin for Transfer<State, C, S, D>
where State: Unpin, S: Unpin, D: Unpin, C: Unpin,

§

impl<State, C, S, D> !UnwindSafe for Transfer<State, C, S, D>

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.