Low-level UART peripheral driver interface definition. More...
Low-level UART peripheral driver interface definition.
Definition in file uart.h.
#include <errno.h>
#include <limits.h>
#include <stddef.h>
#include <stdint.h>
#include "periph_cpu.h"
#include "periph_conf.h"
Go to the source code of this file.
Data Structures | |
struct | uart_isr_ctx_t |
Interrupt context for a UART device. More... | |
Macros | |
#define | CONFIG_UART_DMA_THRESHOLD_BYTES 8 |
Threshold under which polling transfers are used instead of DMA TODO: determine at run-time based on baudrate. | |
#define | UART_UNDEF (UINT_FAST8_MAX) |
Default UART undefined value. | |
#define | UART_DEV(x) (x) |
Default UART device access macro. | |
Typedefs | |
typedef uint_fast8_t | uart_t |
Define default UART type identifier. | |
typedef void(* | uart_rx_cb_t) (void *arg, uint8_t data) |
Signature for receive interrupt callback. | |
typedef void(* | uart_rxstart_cb_t) (void *arg) |
Signature for receive start condition interrupt callback. | |
Enumerations | |
enum | { UART_OK = 0 , UART_NODEV = -ENODEV , UART_NOBAUD = -ENOTSUP , UART_NOMODE = -ENOTSUP , UART_INTERR = -EIO } |
Possible UART return values. More... | |
enum | uart_parity_t { UART_PARITY_NONE , UART_PARITY_EVEN , UART_PARITY_ODD , UART_PARITY_MARK , UART_PARITY_SPACE } |
Definition of possible parity modes. More... | |
enum | uart_data_bits_t { UART_DATA_BITS_5 , UART_DATA_BITS_6 , UART_DATA_BITS_7 , UART_DATA_BITS_8 } |
Definition of possible data bits lengths in a UART frame. More... | |
enum | uart_stop_bits_t { UART_STOP_BITS_1 , UART_STOP_BITS_2 } |
Definition of possible stop bits lengths in a UART frame. More... | |
Functions | |
int | uart_init (uart_t uart, uint32_t baud, uart_rx_cb_t rx_cb, void *arg) |
Initialize a given UART device. | |
void | uart_deinit_pins (uart_t uart) |
Change the pins of the given UART back to plain GPIO functionality. | |
void | uart_init_pins (uart_t uart) |
Initialize the used UART pins, i.e. | |
gpio_t | uart_pin_rx (uart_t uart) |
Get the RX pin of the given UART. | |
gpio_t | uart_pin_tx (uart_t uart) |
Get the TX pin of the given UART. | |
gpio_t | uart_pin_cts (uart_t uart) |
Get the CTS pin of the given UART. | |
gpio_t | uart_pin_rts (uart_t uart) |
Get the RTS pin of the given UART. | |
void | uart_rxstart_irq_configure (uart_t uart, uart_rxstart_cb_t cb, void *arg) |
Configure the function that will be called when a start condition is detected. | |
void | uart_rxstart_irq_enable (uart_t uart) |
Enable the RX start interrupt. | |
void | uart_rxstart_irq_disable (uart_t uart) |
Disable the RX start interrupt. | |
void | uart_collision_detect_enable (uart_t uart) |
Enables collision detection check of the UART. | |
void | uart_collision_detect_disable (uart_t uart) |
Disables collision detection check of the UART. | |
bool | uart_collision_detected (uart_t uart) |
Disables collision detection check of the UART. | |
int | uart_mode (uart_t uart, uart_data_bits_t data_bits, uart_parity_t parity, uart_stop_bits_t stop_bits) |
Setup parity, data and stop bits for a given UART device. | |
void | uart_write (uart_t uart, const uint8_t *data, size_t len) |
Write data from the given buffer to the specified UART device. | |
void | uart_poweron (uart_t uart) |
Power on the given UART device. | |
void | uart_poweroff (uart_t uart) |
Power off the given UART device. | |
void | uart_enable_tx (uart_t uart) |
Enable the TX line one the given UART. | |
void | uart_disable_tx (uart_t uart) |
Disable the TX line one the given UART. | |