Struct embassy_stm32::dma::DoubleBuffered
source · pub struct DoubleBuffered<'a, C: Channel, W: Word> { /* private fields */ }
Expand description
Double-buffered DMA transfer.
Implementations§
source§impl<'a, C: Channel, W: Word> DoubleBuffered<'a, C, W>
impl<'a, C: Channel, W: Word> DoubleBuffered<'a, C, W>
sourcepub unsafe fn new_read(
channel: impl Peripheral<P = C> + 'a,
_request: Request,
peri_addr: *mut W,
buf0: *mut W,
buf1: *mut W,
len: usize,
options: TransferOptions
) -> Self
pub unsafe fn new_read( channel: impl Peripheral<P = C> + 'a, _request: Request, peri_addr: *mut W, buf0: *mut W, buf1: *mut W, len: usize, options: TransferOptions ) -> Self
Create a new read DMA transfer (peripheral to memory).
sourcepub unsafe fn set_buffer0(&mut self, buffer: *mut W)
pub unsafe fn set_buffer0(&mut self, buffer: *mut W)
Set the first buffer address.
You may call this while DMA is transferring the other buffer.
sourcepub unsafe fn set_buffer1(&mut self, buffer: *mut W)
pub unsafe fn set_buffer1(&mut self, buffer: *mut W)
Set the second buffer address.
You may call this while DMA is transferring the other buffer.
sourcepub fn is_buffer0_accessible(&mut self) -> bool
pub fn is_buffer0_accessible(&mut self) -> bool
Returh whether buffer0 is accessible (i.e. whether DMA is transferring buffer1 now)
sourcepub fn set_waker(&mut self, waker: &Waker)
pub fn set_waker(&mut self, waker: &Waker)
Set a waker to be woken when one of the buffers is being transferred.
sourcepub fn request_stop(&mut self)
pub fn request_stop(&mut self)
Request the transfer to stop.
This doesn’t immediately stop the transfer, you have to wait until is_running
returns false.
sourcepub fn is_running(&mut self) -> bool
pub fn is_running(&mut self) -> bool
Return whether this transfer is still running.
If this returns false
, it can be because either the transfer finished, or
it was requested to stop early with request_stop
.
sourcepub fn get_remaining_transfers(&self) -> u16
pub fn get_remaining_transfers(&self) -> u16
Gets the total remaining transfers for the channel Note: this will be zero for transfers that completed without cancellation.