Skip to main content

UartRx

Struct UartRx 

Source
pub struct UartRx<'d, T: Instance, M: Mode> { /* private fields */ }
Expand description

Rx-only UART Driver.

Implementations§

Source§

impl<'d, T: Instance> UartRx<'d, T, Async>

Source

pub fn into_ring_buffered( self, dma_buf: &'d mut [u8], ) -> RingBufferedUartRx<'d, T>

Turn the UartRx into a buffered UART which can continuously receive in the background without the possibility of losing bytes. The dma_buf is a buffer registered to the DMA controller, and must be large enough to prevent overflows.

Source§

impl<'d, T: Instance, M: Mode> UartRx<'d, T, M>

Source

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

Reconfigure the driver

Source

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

Read a single u8 if there is one available, otherwise return WouldBlock

Source

pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error>

Perform a blocking read into buffer

Source§

impl<'d, T: Instance> UartRx<'d, T, Async>

Source

pub fn new<const REMAP: u8>( peri: Peri<'d, T>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, rx: Peri<'d, impl RxPin<T, REMAP>>, rx_dma: Peri<'d, impl RxDma<T>>, config: Config, ) -> Result<Self, ConfigError>

Create a new rx-only UART with no hardware flow control.

Useful if you only want Uart Rx. It saves 1 pin and consumes a little less power.

Source

pub fn new_with_rts<const REMAP: u8>( peri: Peri<'d, T>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, rx: Peri<'d, impl RxPin<T, REMAP>>, rts: Peri<'d, impl RtsPin<T, REMAP>>, rx_dma: Peri<'d, impl RxDma<T>>, config: Config, ) -> Result<Self, ConfigError>

Create a new rx-only UART with a request-to-send pin

Source

pub async fn read(&mut self, buffer: &mut [u8]) -> Result<(), Error>

Initiate an asynchronous UART read

Source

pub async fn read_until_idle( &mut self, buffer: &mut [u8], ) -> Result<usize, Error>

Initiate an asynchronous read with idle line detection enabled

Source§

impl<'d, T: Instance> UartRx<'d, T, Blocking>

Source

pub fn new_blocking<const REMAP: u8>( peri: Peri<'d, T>, rx: Peri<'d, impl RxPin<T, REMAP>>, config: Config, ) -> Result<Self, ConfigError>

Create a new rx-only UART with no hardware flow control.

Useful if you only want Uart Rx. It saves 1 pin and consumes a little less power.

Source

pub fn new_blocking_with_rts<const REMAP: u8>( peri: Peri<'d, T>, rx: Peri<'d, impl RxPin<T, REMAP>>, rts: Peri<'d, impl RtsPin<T, REMAP>>, config: Config, ) -> Result<Self, ConfigError>

Create a new rx-only UART with a request-to-send pin

Trait Implementations§

Source§

impl<'d, T: Instance, M: Mode> Drop for UartRx<'d, T, M>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'d, T, M> !UnwindSafe for UartRx<'d, T, M>

§

impl<'d, T, M> Freeze for UartRx<'d, T, M>

§

impl<'d, T, M> RefUnwindSafe for UartRx<'d, T, M>
where T: RefUnwindSafe, M: RefUnwindSafe,

§

impl<'d, T, M> Send for UartRx<'d, T, M>
where M: Send,

§

impl<'d, T, M> Sync for UartRx<'d, T, M>
where T: Sync, M: Sync,

§

impl<'d, T, M> Unpin for UartRx<'d, T, M>
where T: Unpin, M: Unpin,

§

impl<'d, T, M> UnsafeUnpin for UartRx<'d, T, M>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

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

Performs the conversion.
§

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.