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>
impl<C, S, D> Transfer<Ready, C, S, D>
Sourcepub fn set_a_when_complete(&mut self)
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.
Sourcepub fn set_b_when_complete(&mut self)
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§impl<C, S, D> Transfer<Started, C, S, D>
impl<C, S, D> Transfer<Started, C, S, D>
Sourcepub fn is_active(&self) -> bool
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.
Sourcepub fn is_busy(&self) -> bool
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.
Sourcepub fn error_interrupt_fired(&self) -> bool
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.
Sourcepub fn a_interrupt_fired(&self) -> bool
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.
Sourcepub fn b_interrupt_fired(&self) -> bool
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.
Sourcepub fn wait(
self,
) -> Result<Payload<C, S, D>, (Error<S::Error, D::Error>, Payload<C, S, D>)>
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.