Struct embassy_stm32::usart::RingBufferedUartRx
source · pub struct RingBufferedUartRx<'d, T: BasicInstance, RxDma: RxDma<T>> { /* private fields */ }
Expand description
Rx-only Ring-buffered UART Driver
Implementations§
source§impl<'d, T: BasicInstance, RxDma: RxDma<T>> RingBufferedUartRx<'d, T, RxDma>
impl<'d, T: BasicInstance, RxDma: RxDma<T>> RingBufferedUartRx<'d, T, RxDma>
sourcepub fn start(&mut self) -> Result<(), Error>
pub fn start(&mut self) -> Result<(), Error>
Clear the ring buffer and start receiving in the background
sourcepub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>
pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>
Cleanly stop and reconfigure the driver
sourcepub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
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 the some bytes are available (at least one byte and at most half the buffer size)
Background receive is started if start()
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()
or by re-calling read()
.
Trait Implementations§
source§impl<T: BasicInstance, RxDma: RxDma<T>> Drop for RingBufferedUartRx<'_, T, RxDma>
impl<T: BasicInstance, RxDma: RxDma<T>> Drop for RingBufferedUartRx<'_, T, RxDma>
source§impl<T, Rx> ErrorType for RingBufferedUartRx<'_, T, Rx>where
T: BasicInstance,
Rx: RxDma<T>,
impl<T, Rx> ErrorType for RingBufferedUartRx<'_, T, Rx>where
T: BasicInstance,
Rx: RxDma<T>,
source§impl<T, Rx> Read for RingBufferedUartRx<'_, T, Rx>where
T: BasicInstance,
Rx: RxDma<T>,
impl<T, Rx> Read for RingBufferedUartRx<'_, T, Rx>where
T: BasicInstance,
Rx: RxDma<T>,
source§async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
source§async fn read_exact(
&mut self,
buf: &mut [u8]
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8] ) -> Result<(), ReadExactError<Self::Error>>
Read the exact number of bytes required to fill
buf
. Read moresource§impl<'d, T: BasicInstance, RxDma: RxDma<T>> SetConfig for RingBufferedUartRx<'d, T, RxDma>
impl<'d, T: BasicInstance, RxDma: RxDma<T>> SetConfig for RingBufferedUartRx<'d, T, RxDma>
§type ConfigError = ConfigError
type ConfigError = ConfigError
The error type that can occur if
set_config
fails.source§fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>
fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>
Set the configuration of the driver.
Auto Trait Implementations§
impl<'d, T, RxDma> RefUnwindSafe for RingBufferedUartRx<'d, T, RxDma>where
RxDma: RefUnwindSafe,
T: RefUnwindSafe,
impl<'d, T, RxDma> Send for RingBufferedUartRx<'d, T, RxDma>where
RxDma: Send,
impl<'d, T, RxDma> Sync for RingBufferedUartRx<'d, T, RxDma>
impl<'d, T, RxDma> Unpin for RingBufferedUartRx<'d, T, RxDma>
impl<'d, T, RxDma> !UnwindSafe for RingBufferedUartRx<'d, T, RxDma>
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