embassy-stm32

Crates

git

Versions

stm32wb55rc

Flavors

embassy_stm32::usart

Struct RingBufferedUartRx

Source
pub struct RingBufferedUartRx<'d> { /* private fields */ }
Expand description

Rx-only Ring-buffered UART Driver

Created with UartRx::into_ring_buffered

Implementations§

Source§

impl<'d> RingBufferedUartRx<'d>

Source

pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>

Reconfigure the driver

Source

pub fn start_uart(&mut self)

Configure and start the DMA backed UART receiver

Note: This is also done automatically by [read()] if required.

Source

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().

Source

pub fn set_baudrate(&self, baudrate: u32) -> Result<(), ConfigError>

Set baudrate

Trait Implementations§

Source§

impl Drop for RingBufferedUartRx<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl ErrorType for RingBufferedUartRx<'_>

Source§

type Error = Error

Error type of all the IO operations on this type.
Source§

impl Read for RingBufferedUartRx<'_>

Source§

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>>

Read the exact number of bytes required to fill buf. Read more
Source§

impl ReadReady for RingBufferedUartRx<'_>

Source§

fn read_ready(&mut self) -> Result<bool, Self::Error>

Get whether the reader is ready for immediately reading. Read more
Source§

impl<'d> SetConfig for RingBufferedUartRx<'d>

Source§

type Config = Config

The configuration type used by this driver.
Source§

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>

Set the configuration of the driver.

Auto Trait Implementations§

§

impl<'d> Freeze for RingBufferedUartRx<'d>

§

impl<'d> !RefUnwindSafe for RingBufferedUartRx<'d>

§

impl<'d> Send for RingBufferedUartRx<'d>

§

impl<'d> Sync for RingBufferedUartRx<'d>

§

impl<'d> Unpin for RingBufferedUartRx<'d>

§

impl<'d> !UnwindSafe for RingBufferedUartRx<'d>

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.