pub struct LpuartBbqTx { /* private fields */ }Expand description
A bbqueue powered Lpuart TX Half
Implementations§
Source§impl LpuartBbqTx
impl LpuartBbqTx
Sourcepub fn new(parts: BbqHalfParts, config: BbqConfig) -> Result<Self, BbqError>
pub fn new(parts: BbqHalfParts, config: BbqConfig) -> Result<Self, BbqError>
Create a new LpuartBbq with only the transmit half
NOTE: Dropping the LpuartBbqTx will permanently leak the TX buffer, DMA channel, and tx pin.
Call LpuartBbqTx::teardown to reclaim these resources.
Sourcepub async fn write(&mut self, buf: &[u8]) -> Result<usize, BbqError>
pub async fn write(&mut self, buf: &[u8]) -> Result<usize, BbqError>
Write some data to the outgoing transmit buffer
This method waits until some data is able to be written to the internal buffer,
and returns the number of bytes from buf consumed.
This does NOT guarantee all bytes of buf have been buffered, only the amount returned.
This does NOT guarantee the bytes have been written to the wire. See Self::flush().
Sourcepub async fn flush(&mut self)
pub async fn flush(&mut self)
Wait for all bytes in the outgoing buffer to be flushed asynchronously.
When this method completes, the outgoing buffer is empty.
Sourcepub fn blocking_flush(&mut self)
pub fn blocking_flush(&mut self)
Busy wait until all transmitting has completed
When this method completes, the outgoing buffer is empty.
Sourcepub fn teardown(self) -> BbqHalfParts
pub fn teardown(self) -> BbqHalfParts
Teardown the Tx handle, reclaiming the parts.