Midnight Sun Firmware
|
UART library. More...
Classes | |
struct | UartSettings |
UART Settings. More... | |
Macros | |
#define | UART_MAX_BUFFER_LEN 256U |
Maximum size permitted for a UART transaction. | |
#define | UART_TIMEOUT_MS 1U |
Maximum time permitted for a UART transaction. | |
Enumerations | |
enum | UartPort { UART_PORT_1 = 0 , UART_PORT_2 , NUM_UART_PORTS } |
UART Port selection. | |
enum | UartFlowControl { UART_FLOW_CONTROL_NONE , UART_FLOW_CONTROL_RTS , UART_FLOW_CONTROL_CTS , UART_FLOW_CONTROL_RTS_CTS } |
UART Flow control selection. More... | |
Functions | |
StatusCode | uart_init (UartPort uart, UartSettings *settings) |
Initialize UART instance, assuming standard 8 bits 1 stop bit. More... | |
StatusCode | uart_rx (UartPort uart, uint8_t *data, size_t len) |
Receive data from the UART port. More... | |
StatusCode | uart_tx (UartPort uart, uint8_t *data, size_t len) |
Transmit data from the UART port. More... | |
UART library.
enum UartFlowControl |
UART Flow control selection.
Flow control is a method of synchronizing UART communication between 2 devices. For most applications, this can be set to UART_FLOW_CONTROL_NONE.
StatusCode uart_init | ( | UartPort | uart, |
UartSettings * | settings | ||
) |
Initialize UART instance, assuming standard 8 bits 1 stop bit.
uart | Specifies which UART port to initialize |
settings | Pointer to UART initialization settings |
StatusCode uart_rx | ( | UartPort | uart, |
uint8_t * | data, | ||
size_t | len | ||
) |
Receive data from the UART port.
Receives length bytes of data from UART RX queue. Receives up to UART_MAX_BUFFER_LEN.
uart | Specifies which UART port to read from |
data | Pointer to the data buffer |
len | Length of data to receive |
StatusCode uart_tx | ( | UartPort | uart, |
uint8_t * | data, | ||
size_t | len | ||
) |
Transmit data from the UART port.
Sends length bytes of data from UART TX queue to specified UART port. Sends up to UART_MAX_BUFFER_LEN.
uart | Specifies which UART port to read from |
data | Pointer to the data buffer |
len | Length of data to receive |