docs(uart): improve set/get baud rate API docs

Closes https://github.com/espressif/esp-idf/issues/15449
This commit is contained in:
Song Ruo Jing
2025-03-06 18:47:41 +08:00
parent 96372d2091
commit 3de0b669e7

View File

@ -34,7 +34,8 @@ extern "C" {
* @brief UART configuration parameters for uart_param_config function * @brief UART configuration parameters for uart_param_config function
*/ */
typedef struct { typedef struct {
int baud_rate; /*!< UART baud rate*/ int baud_rate; /*!< UART baud rate
Note that the actual baud rate set could have a slight deviation from the user-configured value due to rounding error*/
uart_word_length_t data_bits; /*!< UART byte size*/ uart_word_length_t data_bits; /*!< UART byte size*/
uart_parity_t parity; /*!< UART parity mode*/ uart_parity_t parity; /*!< UART parity mode*/
uart_stop_bits_t stop_bits; /*!< UART stop bits*/ uart_stop_bits_t stop_bits; /*!< UART stop bits*/
@ -225,7 +226,9 @@ esp_err_t uart_get_parity(uart_port_t uart_num, uart_parity_t* parity_mode);
esp_err_t uart_get_sclk_freq(uart_sclk_t sclk, uint32_t* out_freq_hz); esp_err_t uart_get_sclk_freq(uart_sclk_t sclk, uint32_t* out_freq_hz);
/** /**
* @brief Set UART baud rate. * @brief Set desired UART baud rate.
*
* Note that the actual baud rate set could have a slight deviation from the user-configured value due to rounding error.
* *
* @param uart_num UART port number, the max port number is (UART_NUM_MAX -1). * @param uart_num UART port number, the max port number is (UART_NUM_MAX -1).
* @param baudrate UART baud rate. * @param baudrate UART baud rate.
@ -237,7 +240,9 @@ esp_err_t uart_get_sclk_freq(uart_sclk_t sclk, uint32_t* out_freq_hz);
esp_err_t uart_set_baudrate(uart_port_t uart_num, uint32_t baudrate); esp_err_t uart_set_baudrate(uart_port_t uart_num, uint32_t baudrate);
/** /**
* @brief Get the UART baud rate configuration. * @brief Get the actual UART baud rate.
*
* It returns the real UART rate set in the hardware. It could have a slight deviation from the user-configured baud rate.
* *
* @param uart_num UART port number, the max port number is (UART_NUM_MAX -1). * @param uart_num UART port number, the max port number is (UART_NUM_MAX -1).
* @param baudrate Pointer to accept value of UART baud rate * @param baudrate Pointer to accept value of UART baud rate