pub struct LpuartBbqRx { /* private fields */ }Implementations§
Source§impl LpuartBbqRx
impl LpuartBbqRx
Sourcepub fn new(
parts: BbqHalfParts,
config: BbqConfig,
mode: BbqRxMode,
) -> Result<Self, BbqError>
pub fn new( parts: BbqHalfParts, config: BbqConfig, mode: BbqRxMode, ) -> Result<Self, BbqError>
Create a new LpuartBbq with only the receive half
NOTE: Dropping the LpuartBbqRx will permanently leak the TX buffer, DMA channel, and tx pin.
Call LpuartBbqTx::teardown to reclaim these resources.
Sourcepub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, BbqError>
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, BbqError>
Read some data from the incoming receive buffer
This method waits until some data is able to be read from the internal buffer,
and returns the number of bytes from buf written.
This does NOT guarantee all bytes of buf have been written, only the amount returned.
When receiving, this method must be called somewhat regularly to ensure that the incoming buffer does not become over full.
In this case, data will be discarded until this read method is called and capacity is made available.
Sourcepub fn teardown(self) -> BbqHalfParts
pub fn teardown(self) -> BbqHalfParts
Teardown the Rx handle, reclaiming the DMA channel, receive buffer, and Rx pin.