EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #482 background imageLoading...
Page #482 background image
Chapter 2. API Reference
uart_num: UART port number, the max port number is (UART_NUM_MAX -1).
esp_err_t uart_flush_input(uart_port_t uart_num)
Clear input buffer, discard all the data is in the ring-buffer.
Note In order to send all the data in tx FIFO, we can use uart_wait_tx_done function.
Return
ESP_OK Success
ESP_FAIL Parameter error
Parameters
uart_num: UART port number, the max port number is (UART_NUM_MAX -1).
esp_err_t uart_get_buffered_data_len(uart_port_t uart_num, size_t *size)
UART get RX ring buffer cached data length.
Return
ESP_OK Success
ESP_FAIL Parameter error
Parameters
uart_num: UART port number, the max port number is (UART_NUM_MAX -1).
size: Pointer of size_t to accept cached data length
esp_err_t uart_disable_pattern_det_intr(uart_port_t uart_num)
UART disable pattern detect function. Designed for applications likeAT commands. When the hardware
detects a series of one same character, the interrupt will be triggered.
Return
ESP_OK Success
ESP_FAIL Parameter error
Parameters
uart_num: UART port number, the max port number is (UART_NUM_MAX -1).
esp_err_t uart_enable_pattern_det_baud_intr(uart_port_t uart_num, char pattern_chr,
uint8_t chr_num, int chr_tout, int post_idle, int
pre_idle)
UART enable pattern detect function. Designed for applications like AT commands. When the hardware
detect a series of one same character, the interrupt will be triggered.
Return
ESP_OK Success
ESP_FAIL Parameter error
Parameters
uart_num: UART port number.
pattern_chr: character of the pattern.
chr_num: number of the character, 8bit value.
chr_tout: timeout of the interval between each pattern characters, 16bit value, unit is the baud-
rate cycle you configured. When the duration is more than this value, it will not take this data as
at_cmd char.
post_idle: idle time after the last pattern character, 16bit value, unit is the baud-rate cycle you
configured. When the duration is less than this value, it will not take the previous data as the last
at_cmd char
pre_idle: idle time before the first pattern character, 16bit value, unit is the baud-rate cycle you
configured. When the duration is less than this value, it will not take this data as the first at_cmd
char.
int uart_pattern_pop_pos(uart_port_t uart_num)
Return the nearest detected pattern position in buffer. The positions of the detected pattern are saved in a
queue, this function will dequeue the first pattern position and move the pointer to next pattern position.
The following APIs will modify the pattern position info: uart_flush_input, uart_read_bytes,
uart_driver_delete, uart_pop_pattern_pos It is the applications responsibility to ensure atomic access
to the pattern queue and the rx data buffer when using pattern detect feature.
Espressif Systems 471
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish