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>

source

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).

source

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.

source

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.

source

pub fn is_buffer0_accessible(&mut self) -> bool

Returh whether buffer0 is accessible (i.e. whether DMA is transferring buffer1 now)

source

pub fn set_waker(&mut self, waker: &Waker)

Set a waker to be woken when one of the buffers is being transferred.

source

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.

source

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.

source

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.

Trait Implementations§

source§

impl<'a, C: Channel, W: Word> Drop for DoubleBuffered<'a, C, W>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a, C, W> RefUnwindSafe for DoubleBuffered<'a, C, W>

§

impl<'a, C, W> Send for DoubleBuffered<'a, C, W>
where C: Send, W: Send,

§

impl<'a, C, W> Sync for DoubleBuffered<'a, C, W>
where C: Sync, W: Sync,

§

impl<'a, C, W> Unpin for DoubleBuffered<'a, C, W>
where C: Unpin, W: Unpin,

§

impl<'a, C, W> !UnwindSafe for DoubleBuffered<'a, C, W>

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>,

§

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>,

§

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.