Rx

Struct Rx 

Source
pub struct Rx<I, State> { /* private fields */ }
Expand description

USART receiver

Can be accessed through USART.

§embedded-hal traits

Implementations§

Source§

impl<I, W, Mode> Rx<I, Enabled<W, Mode>>
where I: Instance, W: Word,

Source

pub fn start_address_detection(&mut self, address: u8)

Put the receiver into address detection mode

After this method is called, all received data that does not have the most significant bit set will be ignored. Data that does have the most significant bit set will be matched against the provided address.

While the receiver is operating that way, only matched addresses will be received. Once you have received a matched address and inspected it to your satisfaction, you must call stop_address_detection to start receiving regular data again.

You can call this method multiple times, without calling stop_address_detection in between. The only effect this has, is to change the address that is being matched to the one provided by the most recent call.

Source

pub fn stop_address_detection(&mut self)

Put the receiver out of address detection mode

After you’ve put the receiver into address detection mode using the start_address_detection method, you can start receiving data normally again by calling this method. Typically you would do this after receiving a matched address.

Calling this method while the receiver is not in address detection mode has no effect.

Source

pub fn is_flag_set(&self, flag: Flag) -> bool

Query whether the provided flag is set

Flags that need to be reset by software will be reset by this operation.

Source

pub fn enable_interrupts(&mut self, interrupts: Interrupts)

Enable interrupts

Enables all interrupts set to true in interrupts. Interrupts set to false are not affected.

§Example
use lpc8xx_hal::usart;

// Enable only RXRDY and TXRDY, leave other interrupts untouched.
usart.enable_interrupts(usart::Interrupts {
    RXRDY: true,
    TXRDY: true,
    .. usart::Interrupts::default()
});
Source

pub fn disable_interrupts(&mut self, interrupts: Interrupts)

Disable interrupts

Disables all interrupts set to true in interrupts. Interrupts set to false are not affected.

§Example
use lpc8xx_hal::usart;

// Disable only RXRDY and TXRDY, leave other interrupts untouched.
usart.disable_interrupts(usart::Interrupts {
    RXRDY: true,
    TXRDY: true,
    .. usart::Interrupts::default()
});
Source§

impl<I, Mode> Rx<I, Enabled<u8, Mode>>
where I: Instance,

Source

pub fn read_all( self, buffer: &'static mut [u8], channel: Channel<I::RxChannel, Enabled>, ) -> Transfer<Ready, I::RxChannel, Self, &'static mut [u8]>

Reads until the provided buffer is full, using DMA

§Panics

Panics, if the length of buffer is 0 or larger than 1024.

Trait Implementations§

Source§

impl<I, Mode> Source for Rx<I, Enabled<u8, Mode>>
where I: Instance,

Source§

type Error = Void

The error that can occur while finishing the transfer
Source§

fn is_valid(&self) -> bool

Indicates whether the source is valid Read more
Source§

fn is_empty(&self) -> bool

Indicates whether the source is empty Read more
Source§

fn increment(&self) -> SRCINC_A

The address increment during the transfer Read more
Source§

fn transfer_count(&self) -> Option<u16>

The transfer count, as defined by XFERCFG.XFERCOUNT Read more
Source§

fn end_addr(&self) -> *const u8

The end address Read more
Source§

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

Tell the source to finish the transfer
Source§

impl<I, W, Mode> Read<W> for Rx<I, Enabled<W, Mode>>
where I: Instance, W: Word,

Source§

type Error = Error<W>

Read error
Source§

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

Reads a single word from the serial interface

Auto Trait Implementations§

§

impl<I, State> Freeze for Rx<I, State>

§

impl<I, State> RefUnwindSafe for Rx<I, State>
where I: RefUnwindSafe, State: RefUnwindSafe,

§

impl<I, State> Send for Rx<I, State>
where I: Send, State: Send,

§

impl<I, State> Sync for Rx<I, State>
where I: Sync, State: Sync,

§

impl<I, State> Unpin for Rx<I, State>
where I: Unpin, State: Unpin,

§

impl<I, State> UnwindSafe for Rx<I, State>
where I: UnwindSafe, State: 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<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.