Skip to main content

BufferedUart

Struct BufferedUart 

Source
pub struct BufferedUart { /* private fields */ }
Expand description

Bidirectional pipe buffer for UART communications.

Implementations§

Source§

impl BufferedUart

Source

pub fn new() -> Self

Source

pub async fn run(&self, uart: Uart<'_, Async>)

Transfer data between UART hardware and internal buffers.

This should be awaited from an Embassy task run in an InterruptExecutor for lower latency.

Source

pub async fn read(&self, buf: &mut [u8]) -> usize

Source

pub async fn write(&self, buf: &[u8])

Source

pub fn check_dropped_bytes(&self) -> usize

Number of bytes the RX side dropped since the last call. Resets the counter.

Trait Implementations§

Source§

impl BufferedSerial for BufferedUart

Source§

fn read(&self, buf: &mut [u8]) -> impl Future<Output = usize>

Read as many bytes as are available, up to buf.len(). Returns the number of bytes read. Awaits until at least one byte is available.
Source§

fn write(&self, buf: &[u8]) -> impl Future<Output = ()>

Queue bytes to be written. Completes once buf has been accepted by the internal buffer (may still be in flight on the wire).
Source§

fn check_dropped_bytes(&self) -> usize

Return how many received bytes were dropped since the last call due to the internal buffer being full. Resets the counter.
Source§

impl Default for BufferedUart

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.