pub struct RingBufferedUartRx<'d, T: Instance> { /* private fields */ }Expand description
Rx-only UART driver that receives continuously into a DMA ring buffer.
Unlike UartRx::read, no data is lost between reads, and dropping a read future
doesn’t stop reception.
Implementations§
Source§impl<'d, T: Instance> RingBufferedUartRx<'d, T>
impl<'d, T: Instance> RingBufferedUartRx<'d, T>
Sourcepub fn start_uart(&mut self)
pub fn start_uart(&mut self)
Start receiving in the background into the previously passed buffer.
This is done automatically by read() if required.
Sourcepub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
Read bytes that are readily available in the ring buffer. If no bytes are currently available in the buffer the call waits until some bytes are available (at least one byte and at most half the buffer size), or the line goes idle.
Background receive is started if start_uart() has not been previously called.
Receive in the background is terminated if an error is returned.
It must then manually be started again by calling start_uart() or by re-calling read().