Rx

Struct Rx 

Source
pub struct Rx { /* private fields */ }
Expand description

AXI UARTLITE TX driver.

Can be created by super::AxiUartlite::splitting a regular AXI UARTLITE structure or by Self::stealing it unsafely.

Implementations§

Source§

impl Rx

Source

pub const unsafe fn steal(base_addr: usize) -> Self

Steal the RX part of the UART Lite.

You should only use this if you can not use the regular super::AxiUartlite constructor and the super::AxiUartlite::split method.

This function assumes that the setup of the UART was already done. It can be used to create an RX handle inside an interrupt handler without having to use a critical_section::Mutex if the user can guarantee that the RX handle will only be used by the interrupt handler or only interrupt specific API will be used.

§Safety

The same safey rules specified in super::AxiUartlite apply.

Source

pub fn read_fifo(&mut self) -> Result<u8, Infallible>

Read the RX FIFO.

This functions offers a nb::Result based API and returns nb::Error::WouldBlock if there is nothing to read.

Source

pub fn read_fifo_unchecked(&mut self) -> u8

Read from the FIFO without checking the FIFO fill status.

Source

pub fn has_data(&self) -> bool

Does the RX FIFO have valid data?

Source

pub fn read_whole_fifo(&mut self, buf: &mut [u8; 16]) -> usize

This simply reads all available bytes in the RX FIFO.

It returns the number of read bytes.

Source

pub fn on_interrupt_rx(&mut self, buf: &mut [u8; 16]) -> usize

Can be called in the interrupt handler for the UART Lite to handle RX reception.

Simply calls Rx::read_whole_fifo.

Source

pub fn read_and_clear_last_error(&mut self) -> Option<RxErrors>

Read and clear the last RX errors.

Returns None if no errors have occured.

Trait Implementations§

Source§

impl ErrorType for Rx

Source§

type Error = Infallible

Error type
Source§

impl ErrorType for Rx

Source§

type Error = Infallible

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

impl Read for Rx

Source§

fn read(&mut self) -> Result<u8, Self::Error>

Reads a single word from the serial interface
Source§

impl Read for Rx

Source§

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§

fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>

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

Auto Trait Implementations§

§

impl Freeze for Rx

§

impl RefUnwindSafe for Rx

§

impl Send for Rx

§

impl !Sync for Rx

§

impl Unpin for Rx

§

impl UnwindSafe for Rx

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.