Module imxrt_hal::uart [−][src]
Low Power Universal Asynchronous Receiver/Transmit (LPUART)
The UART module provides a serial peripheral that implements
the embedded_hal::serial
traits. The peripheral is sufficient
for implementing basic serial communications.
UARTs may also be used in bi-directional DMA transfers.
Example
use imxrt_hal; use embedded_hal::serial::{Read, Write}; let mut peripherals = imxrt_hal::Peripherals::take().unwrap(); let uarts = peripherals.uart.clock( &mut peripherals.ccm.handle, imxrt_hal::ccm::uart::ClockSelect::OSC, imxrt_hal::ccm::uart::PrescalarSelect::DIVIDE_1, ); let mut uart = uarts .uart2 .init( peripherals.iomuxc.ad_b1.p02, peripherals.iomuxc.ad_b1.p03, 115_200, ) .unwrap(); uart.set_tx_fifo(core::num::NonZeroU8::new(3)); uart.set_rx_fifo(true); uart.set_parity(Some(imxrt_hal::uart::Parity::Even)); uart.set_rx_inversion(true); uart.set_tx_inversion(false); uart.write(0xDE).unwrap(); let byte = uart.read().unwrap(); // Split the peripheral into transfer and receive halves let (tx, rx) = uart.split();
Structs
ReadError | Type that describes a read error |
ReadErrorFlags | Errors that may occur when reading data |
Rx | A UART receive half |
Tx | A UART transfer half |
UART | An initialized UART peripheral |
UARTs | All available UARTs |
Unclocked | Unclocked UART peripherals |
Uninit | An uninitialized UART peripheral |
Enums
Parity | Parity selection |