Struct rp2040_hal::uart::Reader

source ·
pub struct Reader<D: UartDevice, P: ValidUartPinout<D>> { /* private fields */ }
Expand description

Half of an UartPeripheral that is only capable of reading. Obtained by calling UartPeripheral::split()

Implementations§

source§

impl<D: UartDevice, P: ValidUartPinout<D>> Reader<D, P>

source

pub fn read_raw<'b>(&self, buffer: &'b mut [u8]) -> Result<usize, ReadError<'b>>

Reads bytes from the UART. This function reads as long as it can. As soon that the FIFO is empty, if :

  • 0 bytes were read, a WouldBlock Error is returned
  • some bytes were read, it is deemed to be a success Upon success, it will return how many bytes were read.
source

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

Reads bytes from the UART. This function blocks until the full buffer has been received.

source

pub fn enable_rx_interrupt(&mut self)

Enables the Receive Interrupt.

The relevant UARTx IRQ will fire when there is data in the receive register.

source

pub fn disable_rx_interrupt(&mut self)

Disables the Receive Interrupt.

Trait Implementations§

source§

impl<D: UartDevice, P: ValidUartPinout<D>> ErrorType for Reader<D, P>

§

type Error = ReadErrorType

Error type
source§

impl<D: UartDevice, P: ValidUartPinout<D>> ErrorType for Reader<D, P>

§

type Error = ReadErrorType

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

impl<D: UartDevice, P: ValidUartPinout<D>> Read for Reader<D, P>

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

impl<D: UartDevice, P: ValidUartPinout<D>> Read for Reader<D, P>

source§

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

Reads a single word from the serial interface
source§

impl<D: UartDevice, P: ValidUartPinout<D>> ReadTarget for Reader<D, P>

§

type ReceivedWord = u8

Type which is transferred in a single DMA transfer.
source§

fn rx_treq() -> Option<u8>

Returns the DREQ number for this data source (None for memory buffers).
source§

fn rx_address_count(&self) -> (u32, u32)

Returns the address and the maximum number of words that can be transferred from this data source in a single DMA operation. Read more
source§

fn rx_increment(&self) -> bool

Returns whether the address shall be incremented after each transfer.
source§

impl<D: UartDevice, P: ValidUartPinout<D>> Read<u8> for Reader<D, P>

§

type Error = ReadErrorType

Read error
source§

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

Reads a single word from the serial interface
source§

impl<D: UartDevice, P: ValidUartPinout<D>> EndlessReadTarget for Reader<D, P>

Auto Trait Implementations§

§

impl<D, P> Freeze for Reader<D, P>
where D: Freeze, P: Freeze,

§

impl<D, P> RefUnwindSafe for Reader<D, P>

§

impl<D, P> Send for Reader<D, P>
where D: Send, P: Send,

§

impl<D, P> Sync for Reader<D, P>
where D: Sync, P: Sync,

§

impl<D, P> Unpin for Reader<D, P>
where D: Unpin, P: Unpin,

§

impl<D, P> UnwindSafe for Reader<D, P>
where D: UnwindSafe, P: UnwindSafe,

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<Choices> CoproductSubsetter<CNil, HNil> for Choices

§

type Remainder = Choices

source§

fn subset( self ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T, U, I> LiftInto<U, I> for T
where U: LiftFrom<T, I>,

source§

fn lift_into(self) -> U

Performs the indexed conversion.
source§

impl<Source> Sculptor<HNil, HNil> for Source

§

type Remainder = Source

source§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
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.