Struct imxrt_hal::uart::UART [−][src]
pub struct UART<M: Unsigned> { /* fields omitted */ }
An initialized UART peripheral
Call read()
or write()
to transmit bytes.
Implementations
impl<M> UART<M> where
M: Unsigned,
[src]
M: Unsigned,
pub fn split(self) -> (Tx<M>, Rx<M>)
[src]
Split the UART peripheral into its transfer and receive half
Ensure your UART peripheral is configured before calling
split()
.
pub fn join(tx: Tx<M>, _rx: Rx<M>) -> Self
[src]
Re-combine the transfer and receive halves to create a full UART peripheral
join()
will let you re-configure a UART peripheral if theres a need to change
settings.
pub fn set_parity(&mut self, parity: Option<Parity>)
[src]
Specify parity bit settings. If there is no parity, use None
.
Calling this method will temporarily disable the peripheral, flusing all data from all FIFOs.
pub fn set_rx_inversion(&mut self, inverted: bool)
[src]
Reverse the polarity of received data, affecting all data bits, start and stop bits, and polarity bits.
The default inversion state is false
. Note that calling this method
will temporarily disable the peripheral, flusing all data from all FIFOs.
pub fn set_tx_inversion(&mut self, inverted: bool)
[src]
Reverse the polarity of transferred data, affecting all data bits, start and stop bits, and polarity bits.
The default inversion state is false
. Note that calling this method
will temporarily disable the peripheral, flusing all data from all FIFOs.
pub fn set_tx_fifo(&mut self, size: Option<NonZeroU8>) -> u8
[src]
Controls the TX FIFO.
If size is Some(n)
, where n > 0
, the method will enable the TX
FIFO with a size n
. The method returns size of the FIFO that was
set, which is based on the hardware. On an iMXRT1062, the max size
is 4.
If size is None
, the method disables the TX FIFO. The return is 0.
The method temporarily disables the UART bus, flushing any data in the both TX and RX FIFOs.
pub fn set_rx_fifo(&mut self, enable: bool)
[src]
Enable or disable the RX FIFO. The maximum size of the FIFO is based on the underlying hardware. An iMXRT1062’s RX FIFO is 4 bytes.
Calling this method temporarily disables the peripheral, flusing all data from both TX and RX FIFOs.
pub fn set_baud(&mut self, baud: u32) -> Result<(), TimingsError>
[src]
Set the baud rate for the UART bus. Returns a TimingsError
if there was
an error computing the values that describe the baud rate.
Calling this method temporarily disables the peripheral, flusing all data from both TX and RX FIFOs.
pub fn set_receiver_interrupt(&mut self, watermark: Option<u8>) -> u8
[src]
Enable the receiver interrupt associated with this UART
The interrupt will trigger when there are at least watermark
number of
bytes in the RX FIFO. Returns the maximum-allowable watermark level that
was set in hardware. A watermark of Some(0)
means that we should interrupt
as soon as a byte is read.
If the watermark is greater than 0, ensure that you call set_rx_fifo
before this
method. Otherwise, the return will be 0 despite the supplied watermark.
Disable receiver interrupt by setting watermark
to None
. The return is always 0
when disabling the receiver interrupt.
Trait Implementations
impl<M> Default<u8> for UART<M> where
M: Unsigned,
[src]
M: Unsigned,
impl<M> Read<u8> for UART<M> where
M: Unsigned,
[src]
M: Unsigned,
impl<M> Write<u8> for UART<M> where
M: Unsigned,
[src]
M: Unsigned,
Auto Trait Implementations
impl<M> Send for UART<M> where
M: Send,
M: Send,
impl<M> !Sync for UART<M>
impl<M> Unpin for UART<M> where
M: Unpin,
M: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, Word> Write<Word> for S where
S: Default<Word>,
Word: Clone,
[src]
S: Default<Word>,
Word: Clone,