Module uart

Source
Expand description

§Universal Asynchronous Receiver/Transmitter (UART)

§Overview

The UART is a hardware peripheral which handles communication using serial communication interfaces, such as RS232 and RS485. This peripheral provides a cheap and ubiquitous method for full- and half-duplex communication between devices.

Depending on your device, two or more UART controllers are available for use, all of which can be configured and used in the same way. All UART controllers are compatible with UART-enabled devices from various manufacturers, and can also support Infrared Data Association (IrDA) protocols.

§Configuration

Each UART controller is individually configurable, and the usual setting such as baud rate, data bits, parity, and stop bits can easily be configured. Additionally, the receive (RX) and transmit (TX) pins need to be specified.

The UART controller can be configured to invert the polarity of the pins. This is achieved by inverting the desired pins, and then constructing the UART instance using the inverted pins.

§Usage

The UART driver implements a number of third-party traits, with the intention of making the HAL inter-compatible with various device drivers from the community. This includes, but is not limited to, the embedded-hal and embedded-io blocking traits, and the embedded-hal-async and embedded-io-async asynchronous traits.

In addition to the interfaces provided by these traits, native APIs are also available. See the examples below for more information on how to interact with this driver.

Structs§

AnyUart
Any UART peripheral.
AtCmdConfigunstable
Configuration for the AT-CMD detection functionality
Config
UART Configuration
HwFlowControlunstable
Hardware flow control configuration.
RxConfig
UART Receive part configuration.
TxConfig
UART Transmit part configuration.
Uart
UART (Full-duplex)
UartRxunstable
UART (Receive)
UartTxunstable
UART (Transmit)

Enums§

BaudrateToleranceunstable
Defines how strictly the requested baud rate must be met.
ClockSourceunstable
UART clock source
ConfigError
A configuration error.
CtsConfigunstable
Configuration for CTS (Clear To Send) flow control.
DataBits
Number of data bits
IoErrorunstable
UART Tx or Rx Error
Parity
Parity check
RtsConfigunstable
Configuration for RTS (Request To Send) flow control.
RxError
UART RX Error
StopBits
Number of stop bits
SwFlowControlunstable
Software flow control settings.
TxError
UART TX Error
UartInterruptunstable
List of exposed UART events.

Traits§

Instance
A peripheral singleton compatible with the UART driver.