@@ -83,7 +83,7 @@ static uart_t _uart_bus_array[] = {
83
83
#endif
84
84
85
85
// Negative Pin Number will keep it unmodified, thus this function can detach individual pins
86
- // This function will also unset the pins in the Peripheral Manager and set the pin to -1 after detaching
86
+ // This function will set the pin to -1 after detaching
87
87
static bool _uartDetachPins (uint8_t uart_num , int8_t rxPin , int8_t txPin , int8_t ctsPin , int8_t rtsPin )
88
88
{
89
89
if (uart_num >= SOC_UART_NUM ) {
@@ -96,7 +96,7 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t
96
96
//log_v("detaching UART%d pins: prev,pin RX(%d,%d) TX(%d,%d) CTS(%d,%d) RTS(%d,%d)", uart_num,
97
97
// uart->_rxPin, rxPin, uart->_txPin, txPin, uart->_ctsPin, ctsPin, uart->_rtsPin, rtsPin); vTaskDelay(10);
98
98
99
- // detaches pins and sets Peripheral Manager and UART information
99
+ // detaches pins and sets UART information
100
100
if (rxPin >= 0 && uart -> _rxPin == rxPin ) {
101
101
gpio_hal_iomux_func_sel (GPIO_PIN_MUX_REG [rxPin ], PIN_FUNC_GPIO );
102
102
// avoids causing BREAK in the UART line
@@ -126,7 +126,7 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t
126
126
}
127
127
128
128
// Attach function for UART
129
- // connects the IO Pad, set Paripheral Manager and internal UART structure data
129
+ // connects the IO Pad, set internal UART structure data
130
130
static bool _uartAttachPins (uint8_t uart_num , int8_t rxPin , int8_t txPin , int8_t ctsPin , int8_t rtsPin )
131
131
{
132
132
if (uart_num >= SOC_UART_NUM ) {
@@ -307,7 +307,7 @@ bool _testUartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t
307
307
return false; // no new driver has to be installed
308
308
}
309
309
uart_t * uart = & _uart_bus_array [uart_nr ];
310
- // verify if is necessary to restart the UART driver
310
+ // verify if it is necessary to restart the UART driver
311
311
if (uart_is_driver_installed (uart_nr )) {
312
312
// some parameters can't be changed unless we end the UART driver
313
313
if ( uart -> _rx_buffer_size != rx_buffer_size || uart -> _tx_buffer_size != tx_buffer_size || uart -> _inverted != inverted || uart -> _rxfifo_full_thrhd != rxfifo_full_thrhd ) {
@@ -333,7 +333,7 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx
333
333
if (uart -> lock == NULL ) {
334
334
uart -> lock = xSemaphoreCreateMutex ();
335
335
if (uart -> lock == NULL ) {
336
- log_e ("HAL LOCK error." );
336
+ log_e ("Lock (Mutex) creation error." );
337
337
return NULL ; // no new driver was installed
338
338
}
339
339
}
@@ -447,8 +447,6 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx
447
447
uart -> _rxfifo_full_thrhd = rxfifo_full_thrhd ;
448
448
uart -> _rx_buffer_size = rx_buffer_size ;
449
449
uart -> _tx_buffer_size = tx_buffer_size ;
450
- uart -> _ctsPin = -1 ;
451
- uart -> _rtsPin = -1 ;
452
450
uart -> has_peek = false;
453
451
uart -> peek_byte = 0 ;
454
452
}
@@ -722,8 +720,6 @@ void uartSetBaudRate(uart_t* uart, uint32_t baud_rate)
722
720
723
721
uint32_t uartGetBaudRate (uart_t * uart )
724
722
{
725
- uint32_t baud_rate = 0 ;
726
-
727
723
if (uart == NULL ) {
728
724
return 0 ;
729
725
}
@@ -837,15 +833,8 @@ int log_printfv(const char *format, va_list arg)
837
833
}
838
834
#endif
839
835
*/
840
- //#if CONFIG_IDF_TARGET_ESP32C3
841
836
vsnprintf (temp , len + 1 , format , arg );
842
837
ets_printf ("%s" , temp );
843
- //#else
844
- // int wlen = vsnprintf(temp, len+1, format, arg);
845
- // for (int i = 0; i < wlen; i++) {
846
- // ets_write_char_uart(temp[i]);
847
- // }
848
- //#endif
849
838
/*
850
839
// This causes dead locks with logging and also with constructors that may send logs
851
840
#if !CONFIG_DISABLE_HAL_LOCKS
@@ -857,7 +846,7 @@ int log_printfv(const char *format, va_list arg)
857
846
if (len >= sizeof (loc_buf )){
858
847
free (temp );
859
848
}
860
- // flushes TX - make sure that the log message is completely sent.
849
+ // flushes TX - try to assure that the log message is completely sent.
861
850
if (s_uart_debug_nr != -1 ) while (!uart_ll_is_tx_idle (UART_LL_GET_HW (s_uart_debug_nr )));
862
851
return len ;
863
852
}
0 commit comments