Espressif ESP32-S2 Programming Manual page 483

Table of Contents

Advertisement

Chapter 2. API Reference
Note If the RX buffer is full and flow control is not enabled, the detected pattern may not be found in the rx
buffer due to overflow.
Return
• (-1) No pattern found for current index or parameter error
• others the pattern position in rx buffer.
Parameters
• uart_num: UART port number, the max port number is (UART_NUM_MAX -1).
int
uart_pattern_get_pos(uart_port_t
Return the nearest detected pattern position in buffer. The positions of the detected pattern are saved in a
queue, This function do nothing to the queue.
The following APIs will modify the pattern position info:
uart_driver_delete, uart_pop_pattern_pos It is the application's responsibility to ensure atomic access
to the pattern queue and the rx data buffer when using pattern detect feature.
Note If the RX buffer is full and flow control is not enabled, the detected pattern may not be found in the rx
buffer due to overflow.
Return
• (-1) No pattern found for current index or parameter error
• others the pattern position in rx buffer.
Parameters
• uart_num: UART port number, the max port number is (UART_NUM_MAX -1).
esp_err_t uart_pattern_queue_reset(uart_port_t
Allocate a new memory with the given length to save record the detected pattern position in rx buffer.
Return
• ESP_ERR_NO_MEM No enough memory
• ESP_ERR_INVALID_STATE Driver not installed
• ESP_FAIL Parameter error
• ESP_OK Success
Parameters
• uart_num: UART port number, the max port number is (UART_NUM_MAX -1).
• queue_length: Max queue length for the detected pattern. If the queue length is not large
enough, some pattern positions might be lost. Set this value to the maximum number of patterns
that could be saved in data buffer at the same time.
esp_err_t uart_set_mode(uart_port_t
UART set communication mode.
Note This function must be executed after uart_driver_install(), when the driver object is initialized.
Return
• ESP_OK Success
• ESP_ERR_INVALID_ARG Parameter error
Parameters
• uart_num: Uart number to configure, the max port number is (UART_NUM_MAX -1).
• mode: UART UART mode to set
esp_err_t uart_set_rx_full_threshold(uart_port_t
Set uart threshold value for RX fifo full.
Note If application is using higher baudrate and it is observed that bytes in hardware RX fifo are overwritten
then this threshold can be reduced
Return
• ESP_OK Success
• ESP_ERR_INVALID_ARG Parameter error
• ESP_ERR_INVALID_STATE Driver is not installed
Parameters
• uart_num: UART_NUM_0, UART_NUM_1 or UART_NUM_2
• threshold: Threshold value above which RX fifo full interrupt is generated
Espressif Systems
uart_num)
uart_num, int queue_length)
uart_num,
uart_mode_t
uart_num, int threshold)
472
Submit Document Feedback
uart_flush_input, uart_read_bytes,
mode)
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Table of Contents

Save PDF