Embassy
embassy-stm32

Crates

git

Versions

stm32h755xi-cm4

Flavors

Struct embassy_stm32::usart::RingBufferedUartRx

source ·
pub struct RingBufferedUartRx<'d, T: BasicInstance> { /* private fields */ }
Expand description

Rx-only Ring-buffered UART Driver

Created with UartRx::into_ring_buffered

Implementations§

source§

impl<'d, T: BasicInstance> RingBufferedUartRx<'d, T>

source

pub fn start(&mut self) -> Result<(), Error>

Clear the ring buffer and start receiving in the background

source

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

Cleanly stop and reconfigure the driver

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

Trait Implementations§

source§

impl<T: BasicInstance> Drop for RingBufferedUartRx<'_, T>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<T> ErrorType for RingBufferedUartRx<'_, T>
where T: BasicInstance,

§

type Error = Error

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

impl<T> Read for RingBufferedUartRx<'_, T>
where T: BasicInstance,

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<'d, T: BasicInstance> SetConfig for RingBufferedUartRx<'d, T>

§

type Config = Config

The configuration type used by this driver.
§

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, T> Freeze for RingBufferedUartRx<'d, T>

§

impl<'d, T> RefUnwindSafe for RingBufferedUartRx<'d, T>
where T: RefUnwindSafe,

§

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

§

impl<'d, T> Sync for RingBufferedUartRx<'d, T>
where T: Sync,

§

impl<'d, T> Unpin for RingBufferedUartRx<'d, T>
where T: Unpin,

§

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

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

§

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

§

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.