Skip to content

Commit

Permalink
feat (uart): uses the same IDF 32bits size for TX/RX buffers (#9561)
Browse files Browse the repository at this point in the history
* feat (uart): uses the same IDF 32bits size for TX/RX buffers

Uses the same IDF 32bits size for TX/RX buffers.

Changed header files to use the same IDF buffer limits.
* this is a backport from PR #9554

* feat (uart): change UART events logs to Verbose 

UART events like BREAK or errors are now Verbose instead of Warning Level.

Backporting change from Issue #9551

* feat (uart): uses the same IDF 32bits size for TX/RX buffers.

Uses the same IDF 32bits size for TX/RX buffers.

Changed header files to use the same IDF buffer limits.
* this is a backport from PR #9554

* feat (uart): keep overflow log as warning

Keeps Overflow /  Buffer Full log messages in Warning Level.
  • Loading branch information
SuGlider committed Apr 29, 2024
1 parent 58962d2 commit 5492733
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions cores/esp32/HardwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,19 @@ void HardwareSerial::_uartEventTask(void *args)
currentErr = UART_BUFFER_FULL_ERROR;
break;
case UART_BREAK:
log_w("UART%d RX break.", uart->_uart_nr);
log_v("UART%d RX break.", uart->_uart_nr);
currentErr = UART_BREAK_ERROR;
break;
case UART_PARITY_ERR:
log_w("UART%d parity error.", uart->_uart_nr);
log_v("UART%d parity error.", uart->_uart_nr);
currentErr = UART_PARITY_ERROR;
break;
case UART_FRAME_ERR:
log_w("UART%d frame error.", uart->_uart_nr);
log_v("UART%d frame error.", uart->_uart_nr);
currentErr = UART_FRAME_ERROR;
break;
default:
log_w("UART%d unknown event type %d.", uart->_uart_nr, event.type);
log_v("UART%d unknown event type %d.", uart->_uart_nr, event.type);
break;
}
if (currentErr != UART_NO_ERROR) {
Expand Down
4 changes: 2 additions & 2 deletions cores/esp32/esp32-hal-uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ bool uartSetHwFlowCtrlMode(uart_t *uart, uart_hw_flowcontrol_t mode, uint8_t thr
}

// This helper function will return true if a new IDF UART driver needs to be restarted and false if the current one can continue its execution
bool _testUartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint16_t rx_buffer_size, uint16_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd)
bool _testUartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint32_t rx_buffer_size, uint32_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd)
{
if(uart_nr >= SOC_UART_NUM) {
return false; // no new driver has to be installed
Expand All @@ -320,7 +320,7 @@ bool _testUartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t
}
}

uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint16_t rx_buffer_size, uint16_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd)
uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint32_t rx_buffer_size, uint32_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd)
{
if(uart_nr >= SOC_UART_NUM) {
log_e("UART number is invalid, please use number from 0 to %u", SOC_UART_NUM - 1);
Expand Down
4 changes: 2 additions & 2 deletions cores/esp32/esp32-hal-uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ extern "C" {
struct uart_struct_t;
typedef struct uart_struct_t uart_t;

bool _testUartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint16_t rx_buffer_size, uint16_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd);
uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint16_t rx_buffer_size, uint16_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd);
bool _testUartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint32_t rx_buffer_size, uint32_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd);
uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint32_t rx_buffer_size, uint32_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd);
void uartEnd(uint8_t uart_num);

// This is used to retrieve the Event Queue pointer from a UART IDF Driver in order to allow user to deal with its events
Expand Down

0 comments on commit 5492733

Please sign in to comment.