Chapter 2. API Reference
• wakeup_threshold: number of RX edges for light sleep wakeup, value is 3 .. 0x3ff.
esp_err_t uart_get_wakeup_threshold(uart_port_t uart_num, int *out_wakeup_threshold)
Get the number of RX pin signal edges for light sleep wakeup.
See description of uart_set_wakeup_threshold for the explanation of UART wakeup feature.
Return
• ESP_OK on success
• ESP_ERR_INVALID_ARG if out_wakeup_threshold is NULL
Parameters
• uart_num: UART number, the max port number is (UART_NUM_MAX -1).
• [out] out_wakeup_threshold: output, set to the current value of wakeup threshold for the
given UART.
esp_err_t uart_wait_tx_idle_polling(uart_port_t uart_num)
Wait until UART tx memory empty and the last char send ok (polling mode).
• Return
– ESP_OK on success
– ESP_ERR_INVALID_ARG Parameter error
– ESP_FAIL Driver not installed
Parameters
• uart_num: UART number
esp_err_t uart_set_loop_back(uart_port_t uart_num, bool loop_back_en)
Configure TX signal loop back to RX module, just for the test usage.
• Return
– ESP_OK on success
– ESP_ERR_INVALID_ARG Parameter error
– ESP_FAIL Driver not installed
Parameters
• uart_num: UART number
• loop_back_en: Set ture to enable the loop back function, else set it false.
void uart_set_always_rx_timeout(uart_port_t uart_num, bool always_rx_timeout_en)
Configure behavior of UART RX timeout interrupt.
When always_rx_timeout is true, timeout interrupt is triggered even if FIFO is full. This function can cause
extra timeout interrupts triggered only to send the timeout event. Call this function only if you want to ensure
timeout interrupt will always happen after a byte stream.
Parameters
• uart_num: UART number
• always_rx_timeout_en: Set to false enable the default behavior of timeout interrupt, set it to
true to always trigger timeout interrupt.
Structures
struct uart_intr_config_t
UART interrupt configuration parameters for uart_intr_config function.
Public Members
uint32_t intr_enable_mask
UART interrupt enable mask, choose from UART_XXXX_INT_ENA_M under
UART_INT_ENA_REG(i), connect with bit-or operator
uint8_t rx_timeout_thresh
UART timeout interrupt threshold (unit: time of sending one byte)
Espressif Systems 474
Submit Document Feedback
Release v4.4