File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -594,6 +594,18 @@ esp_err_t uart_flush_input(uart_port_t uart_num);
594
594
*/
595
595
esp_err_t uart_get_buffered_data_len (uart_port_t uart_num , size_t * size );
596
596
597
+ /**
598
+ * @brief UART get TX ring buffer free space size
599
+ *
600
+ * @param uart_num UART port number, the max port number is (UART_NUM_MAX -1).
601
+ * @param size Pointer of size_t to accept the free space size
602
+ *
603
+ * @return
604
+ * - ESP_OK Success
605
+ * - ESP_ERR_INVALID_ARG Parameter error
606
+ */
607
+ esp_err_t uart_get_tx_buffer_free_size (uart_port_t uart_num , size_t * size );
608
+
597
609
/**
598
610
* @brief UART disable pattern detect function.
599
611
* Designed for applications like 'AT commands'.
Original file line number Diff line number Diff line change @@ -1343,6 +1343,15 @@ esp_err_t uart_get_buffered_data_len(uart_port_t uart_num, size_t *size)
1343
1343
return ESP_OK ;
1344
1344
}
1345
1345
1346
+ esp_err_t uart_get_tx_buffer_free_size (uart_port_t uart_num , size_t * size )
1347
+ {
1348
+ ESP_RETURN_ON_FALSE ((uart_num < UART_NUM_MAX ), ESP_ERR_INVALID_ARG , UART_TAG , "uart_num error" );
1349
+ ESP_RETURN_ON_FALSE ((p_uart_obj [uart_num ]), ESP_ERR_INVALID_ARG , UART_TAG , "uart driver error" );
1350
+ ESP_RETURN_ON_FALSE ((size != NULL ), ESP_ERR_INVALID_ARG , UART_TAG , "arg pointer is NULL" );
1351
+ * size = p_uart_obj [uart_num ]-> tx_buf_size - p_uart_obj [uart_num ]-> tx_len_tot ;
1352
+ return ESP_OK ;
1353
+ }
1354
+
1346
1355
esp_err_t uart_flush (uart_port_t uart_num ) __attribute__((alias ("uart_flush_input" )));
1347
1356
1348
1357
esp_err_t uart_flush_input (uart_port_t uart_num )
You can’t perform that action at this time.
0 commit comments