Skip to content

Commit 97ae20d

Browse files
authored
Update esp32-hal-uart.c
1 parent 5e85ac4 commit 97ae20d

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

cores/esp32/esp32-hal-uart.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -439,17 +439,11 @@ uart_t *uartBegin(
439439
uartEnd(uart_nr);
440440
} else {
441441
bool retCode = true;
442-
UART_MUTEX_LOCK();
443442
//User may just want to change some parameters, such as baudrate, data length, parity, stop bits or pins
444443
if (uart->_baudrate != baudrate) {
445-
if (!uartSetBaudRate(uart, baudrate)) {
446-
log_e("UART%d changing baudrate failed.", uart_nr);
447-
retCode = false;
448-
} else {
449-
log_v("UART%d changed baudrate to %d", uart_nr, baudrate);
450-
uart->_baudrate = baudrate;
451-
}
444+
retCode = uartSetBaudRate(uart, baudrate);
452445
}
446+
UART_MUTEX_LOCK();
453447
uart_word_length_t data_bits = (config & 0xc) >> 2;
454448
uart_parity_t parity = config & 0x3;
455449
uart_stop_bits_t stop_bits = (config & 0x30) >> 4;

0 commit comments

Comments
 (0)