pub struct BufferedUart { /* private fields */ }Expand description
Bidirectional pipe buffer for UART communications.
Implementations§
Source§impl BufferedUart
impl BufferedUart
pub fn new() -> Self
Sourcepub async fn run(&self, uart: Uart<'_, Async>)
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.
pub async fn read(&self, buf: &mut [u8]) -> usize
pub async fn write(&self, buf: &[u8])
Sourcepub fn check_dropped_bytes(&self) -> usize
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
impl BufferedSerial for BufferedUart
Source§fn read(&self, buf: &mut [u8]) -> impl Future<Output = usize>
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 = ()>
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
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.
Auto Trait Implementations§
impl !Freeze for BufferedUart
impl !RefUnwindSafe for BufferedUart
impl Send for BufferedUart
impl Sync for BufferedUart
impl Unpin for BufferedUart
impl UnsafeUnpin for BufferedUart
impl UnwindSafe for BufferedUart
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