Skip to main content

RingBufferedUartRx

Struct RingBufferedUartRx 

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

Source

pub fn start_uart(&mut self)

Start receiving in the background into the previously passed buffer.

This is done automatically by read() if required.

Source

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

Trait Implementations§

Source§

impl<T: Instance> Drop for RingBufferedUartRx<'_, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'d, T> !UnwindSafe for RingBufferedUartRx<'d, T>

§

impl<'d, T> Freeze for RingBufferedUartRx<'d, T>

§

impl<'d, T> RefUnwindSafe for RingBufferedUartRx<'d, T>
where T: RefUnwindSafe,

§

impl<'d, T> Send for RingBufferedUartRx<'d, T>

§

impl<'d, T> Sync for RingBufferedUartRx<'d, T>
where T: Sync,

§

impl<'d, T> Unpin for RingBufferedUartRx<'d, T>
where T: Unpin,

§

impl<'d, T> UnsafeUnpin for RingBufferedUartRx<'d, T>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.