@web-font-path: "roboto-debian.css";
Loading...
Searching...
No Matches
uart.h File Reference
#include "pico.h"
#include "hardware/structs/uart.h"
#include "hardware/regs/dreq.h"
#include "hardware/regs/intctrl.h"
#include "hardware/resets.h"
Include dependency graph for uart.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PARAM_ASSERTIONS_ENABLED_HARDWARE_UART   0
#define PICO_UART_ENABLE_CRLF_SUPPORT   1
#define PICO_UART_DEFAULT_CRLF   0
#define PICO_DEFAULT_UART_BAUD_RATE   115200
 Default baud rate.
#define UART_NUM(uart)
 Returns the UART number for a UART instance.
#define UART_INSTANCE(num)
 Returns the UART instance with the given UART number.
#define UART_DREQ_NUM(uart, is_tx)
 Returns the dreq_num_t used for pacing DMA transfers to or from this UART instance. If is_tx is true, then it is for transfers to the UART else for transfers from the UART.
#define UART_CLOCK_NUM(uart)
 Returns clock_num_t of the clock for the given UART instance.
#define UART_FUNCSEL_NUM(uart, gpio)
 Returns gpio_function_t needed to select the UART function for the given UART instance on the given GPIO number.
#define UART_IRQ_NUM(uart)
 Returns the irq_num_t for processor interrupts from the given UART instance.
#define UART_RESET_NUM(uart)
 Returns the reset_num_t used to reset a given UART instance.
#define uart0   ((uart_inst_t *)uart0_hw)
 Identifier for UART instance 0.
#define uart1   ((uart_inst_t *)uart1_hw)
 Identifier for UART instance 1.

Typedefs

typedef struct uart_inst uart_inst_t

Enumerations

enum  uart_parity_t { UART_PARITY_NONE , UART_PARITY_EVEN , UART_PARITY_ODD }
 UART Parity enumeration.

Functions

static uint uart_get_index (uart_inst_t *uart)
 Convert UART instance to hardware instance number.
static uart_inst_t * uart_get_instance (uint num)
 Get the UART instance from an instance number.
static uart_hw_tuart_get_hw (uart_inst_t *uart)
 Get the real hardware UART instance from a UART instance.
uint uart_init (uart_inst_t *uart, uint baudrate)
 Initialise a UART.
void uart_deinit (uart_inst_t *uart)
 DeInitialise a UART.
uint uart_set_baudrate (uart_inst_t *uart, uint baudrate)
 Set UART baud rate.
static void uart_set_hw_flow (uart_inst_t *uart, bool cts, bool rts)
 Set UART flow control CTS/RTS.
void uart_set_format (uart_inst_t *uart, uint data_bits, uint stop_bits, uart_parity_t parity)
 Set UART data format.
static void uart_set_irqs_enabled (uart_inst_t *uart, bool rx_has_data, bool tx_needs_data)
 Enable/Disable UART interrupt outputs.
static void uart_set_irq_enables (uart_inst_t *uart, bool rx_has_data, bool tx_needs_data)
static bool uart_is_enabled (uart_inst_t *uart)
 Test if specific UART is enabled.
void uart_set_fifo_enabled (uart_inst_t *uart, bool enabled)
 Enable/Disable the FIFOs on specified UART.
static bool uart_is_writable (uart_inst_t *uart)
 Determine if space is available in the TX FIFO.
static void uart_tx_wait_blocking (uart_inst_t *uart)
 Wait for the UART TX fifo to be drained.
static bool uart_is_readable (uart_inst_t *uart)
 Determine whether data is waiting in the RX FIFO.
static void uart_write_blocking (uart_inst_t *uart, const uint8_t *src, size_t len)
 Write to the UART for transmission.
static void uart_read_blocking (uart_inst_t *uart, uint8_t *dst, size_t len)
 Read from the UART.
static void uart_putc_raw (uart_inst_t *uart, char c)
 Write single character to UART for transmission.
static void uart_putc (uart_inst_t *uart, char c)
 Write single character to UART for transmission, with optional CR/LF conversions.
static void uart_puts (uart_inst_t *uart, const char *s)
 Write string to UART for transmission, doing any CR/LF conversions.
static char uart_getc (uart_inst_t *uart)
 Read a single character from the UART.
void uart_set_break (uart_inst_t *uart, bool en)
 Assert a break condition on the UART transmission.
void uart_set_translate_crlf (uart_inst_t *uart, bool translate)
 Set CR/LF conversion on UART.
static void uart_default_tx_wait_blocking (void)
 Wait for the default UART's TX FIFO to be drained.
bool uart_is_readable_within_us (uart_inst_t *uart, uint32_t us)
 Wait for up to a certain number of microseconds for the RX FIFO to be non empty.
static uint uart_get_dreq_num (uart_inst_t *uart, bool is_tx)
 Return the dreq_num_t to use for pacing transfers to/from a particular UART instance.
static uint uart_get_reset_num (uart_inst_t *uart)
 Return the reset_num_t to use to reset a particular UART instance.
static uint uart_get_dreq (uart_inst_t *uart, bool is_tx)