Esp32/Components/driver/include/driver/uart.h
Go to the documentation of this file.
28 * For uart_write_xxx functions, if there is no space in the tx FIFO it will return a short count. It will not wait.
30 * Code is now C++ only; reference to this header has been removed from esp_systemapi.h uart structure should be
207 smg_uart_t* smg_uart_init(uint8_t uart_nr, uint32_t baudrate, uint32_t config, smg_uart_mode_t mode, uint8_t tx_pin, size_t rx_size, size_t tx_size = 0);
struct SerialBuffer * rx_buffer
Optional receive buffer.
Definition: Esp8266/Components/driver/include/driver/uart.h:186
smg_uart_t * smg_uart_init_ex(const smg_uart_config &cfg)
Both receive and transmit - will revert to TX only if RX not supported.
Definition: Esp32/Components/driver/include/driver/uart.h:104
Called to ensure all buffered data is output.
Definition: Esp32/Components/driver/include/driver/uart.h:159
static int smg_uart_read_char(smg_uart_t *uart)
read a received character
Definition: Esp32/Components/driver/include/driver/uart.h:338
uint8_t rx_headroom
Callback when rx_buffer free space <= headroom.
Definition: Esp8266/Components/driver/include/driver/uart.h:184
smg_uart_t * smg_uart_init(uint8_t uart_nr, uint32_t baudrate, uint32_t config, smg_uart_mode_t mode, uint8_t tx_pin, size_t rx_size, size_t tx_size=0)
void smg_uart_swap(smg_uart_t *uart, int tx_pin)
int smg_uart_peek_last_char(smg_uart_t *uart)
fetch last character read out of FIFO
Called immediately before uart is closed and destroyed.
Definition: Esp32/Components/driver/include/driver/uart.h:150
Definition: Esp8266/Components/driver/include/driver/uart.h:193
bool smg_uart_set_notify(unsigned uart_nr, smg_uart_notify_callback_t callback)
Set the notification callback function.
Called when uart has been iniitialised successfully.
Definition: Esp32/Components/driver/include/driver/uart.h:147
uint16_t status
All status flags reported to callback since last uart_get_status() call.
Definition: Esp8266/Components/driver/include/driver/uart.h:185
smg_uart_option_bits_t
bit values for options argument of uart_init
Definition: Esp8266/Components/driver/include/driver/uart.h:113
bool smg_uart_tx_enabled(smg_uart_t *uart)
Definition: Esp8266/Components/driver/include/driver/uart.h:270
uint8_t smg_uart_disable_interrupts()
disable interrupts and return current interrupt state
void smg_uart_flush(smg_uart_t *uart, smg_uart_mode_t mode=UART_FULL)
discard any buffered data and reset hardware FIFOs
void * param
User-supplied callback parameter.
Definition: Esp8266/Components/driver/include/driver/uart.h:189
uint32_t smg_uart_set_baudrate(smg_uart_t *uart, uint32_t baud_rate)
set UART baud rate
void smg_uart_set_pins(smg_uart_t *uart, int tx, int rx)
smg_uart_t * smg_uart_get_uart(uint8_t uart_nr)
Get the uart structure for the given number.
enum smg_uart_mode_ smg_uart_mode_t
Definition: Esp32/Components/driver/include/driver/uart.h:108
Definition: Esp8266/Components/driver/include/driver/uart.h:177
void smg_uart_wait_tx_empty(smg_uart_t *uart)
static size_t smg_uart_write_char(smg_uart_t *uart, char c)
queue a single character for output
Definition: Esp32/Components/driver/include/driver/uart.h:321
size_t smg_uart_rx_available(smg_uart_t *uart)
determine available data which can be read
int smg_uart_get_debug()
size_t smg_uart_rx_buffer_size(smg_uart_t *uart)
uint32_t baud_rate
Definition: Esp8266/Components/driver/include/driver/uart.h:179
static void smg_uart_set_options(smg_uart_t *uart, uart_options_t options)
Set option flags.
Definition: Esp32/Components/driver/include/driver/uart.h:244
void smg_uart_restore_interrupts()
re-enable interrupts after calling uart_disable_interrupts()
size_t smg_uart_resize_rx_buffer(smg_uart_t *uart, size_t new_size)
void(* smg_uart_notify_callback_t)(smg_uart_t *uart, smg_uart_notify_code_t code)
Port notification callback function type.
Definition: Esp32/Components/driver/include/driver/uart.h:166
ISR invokes user callback function with no pre-processing.
Definition: Esp32/Components/driver/include/driver/uart.h:116
void(* smg_uart_callback_t)(smg_uart_t *uart, uint32_t status)
callback invoked directly from ISR
Definition: Esp32/Components/driver/include/driver/uart.h:136
Called before data is read from rx buffer.
Definition: Esp32/Components/driver/include/driver/uart.h:156
void smg_uart_set_debug(int uart_nr)
struct SerialBuffer * tx_buffer
Optional transmit buffer.
Definition: Esp8266/Components/driver/include/driver/uart.h:187
int smg_uart_rx_find(smg_uart_t *uart, char c)
smg_uart_notify_code_t
Indicates notification, parameters refer to uart_notify_info_t structure.
Definition: Esp8266/Components/driver/include/driver/uart.h:144
int smg_uart_peek_char(smg_uart_t *uart)
see what the next character in the rx buffer is
size_t smg_uart_tx_buffer_size(smg_uart_t *uart)
void smg_uart_set_tx(smg_uart_t *uart, int tx_pin)
void smg_uart_uninit(smg_uart_t *uart)
void smg_uart_set_break(smg_uart_t *uart, bool state)
Set or clear a break condition on the TX line.
size_t smg_uart_write(smg_uart_t *uart, const void *buffer, size_t size)
write a block of data
If buffers are full then uart_write() will wait for free space.
Definition: Esp32/Components/driver/include/driver/uart.h:115
int smg_uart_get_nr(smg_uart_t *uart)
Definition: Esp8266/Components/driver/include/driver/uart.h:211
Called after data has been written into tx buffer.
Definition: Esp32/Components/driver/include/driver/uart.h:153
smg_uart_callback_t callback
Optional User callback routine.
Definition: Esp8266/Components/driver/include/driver/uart.h:188
bool smg_uart_rx_enabled(smg_uart_t *uart)
Definition: Esp8266/Components/driver/include/driver/uart.h:275
smg_uart_mode_
values for mode argument of uart_init
Definition: Esp8266/Components/driver/include/driver/uart.h:102
void * smg_uart_get_callback_param(smg_uart_t *uart)
Get the callback parameter specified by uart_set_callback()
Definition: Esp8266/Components/driver/include/driver/uart.h:233
uint32_t smg_uart_get_baudrate(smg_uart_t *uart)
get the actual baud rate in use
size_t smg_uart_resize_tx_buffer(smg_uart_t *uart, size_t new_size)
uint32_t smg_uart_set_baudrate_reg(int uart_nr, uint32_t baud_rate)
set UART baud rate, given the UART number
void smg_uart_set_callback(smg_uart_t *uart, smg_uart_callback_t callback, void *param)
Set callback handler for serial port.
static uart_options_t smg_uart_get_options(smg_uart_t *uart)
Definition: Esp32/Components/driver/include/driver/uart.h:263