pub struct Reader<D, P>where
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, P> Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Sourcepub fn read_raw<'b>(
&self,
buffer: &'b mut [u8],
) -> Result<usize, Error<ReadError<'b>>>
pub fn read_raw<'b>( &self, buffer: &'b mut [u8], ) -> Result<usize, Error<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.
Sourcepub fn read_full_blocking(&self, buffer: &mut [u8]) -> Result<(), ReadErrorType>
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.
Sourcepub fn enable_rx_interrupt(&mut self)
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.
Sourcepub fn disable_rx_interrupt(&mut self)
pub fn disable_rx_interrupt(&mut self)
Disables the Receive Interrupt.
Trait Implementations§
Source§impl<D, P> ErrorType for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> ErrorType for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§type Error = ReadErrorType
type Error = ReadErrorType
Error type
Source§impl<D, P> ErrorType for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> ErrorType for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§type Error = ReadErrorType
type Error = ReadErrorType
Error type of all the IO operations on this type.
Source§impl<D, P> Read<u8> for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> Read<u8> for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§impl<D, P> Read for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> Read for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§impl<D, P> Read for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> Read for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§fn read(
&mut self,
buf: &mut [u8],
) -> Result<usize, <Reader<D, P> as ErrorType>::Error>
fn read( &mut self, buf: &mut [u8], ) -> Result<usize, <Reader<D, P> as ErrorType>::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>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
Read the exact number of bytes required to fill
buf. Read moreSource§impl<D, P> ReadReady for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> ReadReady for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§impl<D, P> ReadTarget for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> ReadTarget for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§type ReceivedWord = u8
type ReceivedWord = u8
Type which is transferred in a single DMA transfer.
Source§fn rx_treq() -> Option<u8>
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)
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
fn rx_increment(&self) -> bool
Returns whether the address shall be incremented after each transfer.
impl<D, P> EndlessReadTarget for Reader<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Auto Trait Implementations§
impl<D, P> Freeze for Reader<D, P>
impl<D, P> RefUnwindSafe for Reader<D, P>where
D: RefUnwindSafe,
P: RefUnwindSafe,
impl<D, P> Send for Reader<D, P>
impl<D, P> Sync for Reader<D, P>
impl<D, P> Unpin for Reader<D, P>
impl<D, P> UnwindSafe for Reader<D, P>where
D: UnwindSafe,
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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