pub struct RingBuffer<'channel, 'buf, W: Word> { /* private fields */ }Expand description
A ring buffer for continuous DMA reception.
Can only be constructed by drivers in this HAL, and not from the application.
This structure manages a circular DMA transfer, allowing continuous reception of data without losing bytes between reads. It uses both half-transfer and complete-transfer interrupts to track available data.
Implementations§
Source§impl<'channel, 'buf, W: Word> RingBuffer<'channel, 'buf, W>
impl<'channel, 'buf, W: Word> RingBuffer<'channel, 'buf, W>
Sourcepub fn is_overrun(&self) -> bool
pub fn is_overrun(&self) -> bool
Check if the buffer has overrun (data was lost).
This happens when DMA writes faster than the application reads.
Sourcepub fn read_immediate(&self, dst: &mut [W]) -> usize
pub fn read_immediate(&self, dst: &mut [W]) -> usize
Read data from the ring buffer into the provided slice.
Returns the number of elements read, which may be less than
dst.len() if not enough data is available.
This method does not block; use read_async() for async waiting.
Trait Implementations§
Auto Trait Implementations§
impl<'channel, 'buf, W> !Freeze for RingBuffer<'channel, 'buf, W>
impl<'channel, 'buf, W> RefUnwindSafe for RingBuffer<'channel, 'buf, W>where
W: RefUnwindSafe,
impl<'channel, 'buf, W> !Send for RingBuffer<'channel, 'buf, W>
impl<'channel, 'buf, W> !Sync for RingBuffer<'channel, 'buf, W>
impl<'channel, 'buf, W> Unpin for RingBuffer<'channel, 'buf, W>
impl<'channel, 'buf, W> !UnwindSafe for RingBuffer<'channel, 'buf, W>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more