Skip to content

Commit 530fcd0

Browse files
authored
feat(uart): considering both HP and LP default uart clock source
1 parent 5ed541d commit 530fcd0

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

cores/esp32/HardwareSerial.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -619,11 +619,7 @@ bool HardwareSerial::setMode(SerialMode mode) {
619619
// Note: CLK_SRC_PLL Freq depends on the SoC - ESP32-C2 has 40MHz, ESP32-H2 has 48MHz and ESP32-C5, C6, C61 and P4 has 80MHz
620620
// Note: ESP32-C6, C61, ESP32-P4 and ESP32-C5 have LP UART that will use only RTC_FAST or XTAL/2 as Clock Source
621621
bool HardwareSerial::setClockSource(SerialClkSrc clkSrc) {
622-
if (clkSrc == UART_CLK_SRC_DEFAULT) {
623-
return uartSetClockSource(_uart, (uart_sclk_t) UART_SCLK_DEFAULT);
624-
} else {
625-
return uartSetClockSource(_uart, (uart_sclk_t) clkSrc);
626-
}
622+
return uartSetClockSource(_uart, (int8_t) clkSrc); // allows negative values for UART_CLK_SRC_DEFAULT
627623
}
628624

629625
// minimum total RX Buffer size is the UART FIFO space (128 bytes for most SoC) + 1. IDF imposition.

0 commit comments

Comments
 (0)