Low-level UART peripheral driver interface definition. More...
Low-level UART peripheral driver interface definition.
Definition in file uart.h.
#include <stddef.h>
#include <stdint.h>
#include <limits.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 | UART_UNDEF (UINT_MAX) |
Default UART undefined value. | |
#define | UART_DEV(x) (x) |
Default UART device access macro. | |
Typedefs | |
typedef unsigned int | uart_t |
Define default UART type identifier. | |
typedef void(* | uart_rx_cb_t) (void *arg, uint8_t data) |
Signature for receive interrupt callback. More... | |
Enumerations | |
enum | { UART_OK = 0, UART_NODEV = -1, UART_NOBAUD = -2, UART_INTERR = -3, UART_NOMODE = -4 } |
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 baudrate, uart_rx_cb_t rx_cb, void *arg) |
Initialize a given UART device. More... | |
void | uart_deinit_pins (uart_t uart) |
Change the pins of the given UART back to plain GPIO functionality. More... | |
void | uart_init_pins (uart_t uart) |
Initialize the used UART pins, i.e. More... | |
gpio_t | uart_pin_rx (uart_t uart) |
Get the RX pin of the given UART. More... | |
gpio_t | uart_pin_tx (uart_t uart) |
Get the TX pin of the given UART. More... | |
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. More... | |
void | uart_write (uart_t uart, const uint8_t *data, size_t len) |
Write data from the given buffer to the specified UART device. More... | |
void | uart_poweron (uart_t uart) |
Power on the given UART device. More... | |
void | uart_poweroff (uart_t uart) |
Power off the given UART device. More... | |