Struct stm32f7xx_hal::dma::Transfer
source · [−]pub struct Transfer<T: Target, B, State> { /* private fields */ }
Expand description
Represents an ongoing DMA transfer
Peripheral APIs that support DMA have methods like write_all
and
read_all
, which return instances of this struct.
Implementations
sourceimpl<T, B> Transfer<T, B, Ready> where
T: Target,
B: 'static,
impl<T, B> Transfer<T, B, Ready> where
T: Target,
B: 'static,
sourcepub fn enable_interrupts(
&mut self,
handle: &Handle<T::Instance, Enabled>,
interrupts: Interrupts
)
pub fn enable_interrupts(
&mut self,
handle: &Handle<T::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 stream.
sourceimpl<T, B> Transfer<T, B, Started> where
T: Target,
impl<T, B> Transfer<T, B, Started> where
T: Target,
sourcepub fn is_active(&self, handle: &Handle<T::Instance, Enabled>) -> bool
pub fn is_active(&self, handle: &Handle<T::Instance, Enabled>) -> bool
Checks whether the transfer is still ongoing
sourcepub fn cancel(&self, handle: &Handle<T::Instance, Enabled>)
pub fn cancel(&self, handle: &Handle<T::Instance, Enabled>)
Try to cancel an in process transfer. Check is_active to verify cancellation
sourcepub fn wait(
self,
handle: &Handle<T::Instance, Enabled>
) -> Result<TransferResources<T, B>, (TransferResources<T, B>, Error)>
pub fn wait(
self,
handle: &Handle<T::Instance, Enabled>
) -> Result<TransferResources<T, B>, (TransferResources<T, B>, Error)>
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<T, B, State> RefUnwindSafe for Transfer<T, B, State> where
B: RefUnwindSafe,
State: RefUnwindSafe,
T: RefUnwindSafe,
<T as Target>::Stream: RefUnwindSafe,
impl<T, B, State> Send for Transfer<T, B, State> where
B: Send,
State: Send,
T: Send,
<T as Target>::Stream: Send,
impl<T, B, State> Sync for Transfer<T, B, State> where
B: Sync,
State: Sync,
T: Sync,
<T as Target>::Stream: Sync,
impl<T, B, State> Unpin for Transfer<T, B, State> where
B: Unpin,
State: Unpin,
T: Unpin,
<T as Target>::Stream: Unpin,
impl<T, B, State> UnwindSafe for Transfer<T, B, State> where
B: UnwindSafe,
State: UnwindSafe,
T: UnwindSafe,
<T as Target>::Stream: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more