Skip to content

Commit 36efd18

Browse files
authored
feat(uart): add uart hall function to set the uart clock source
1 parent baced53 commit 36efd18

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cores/esp32/esp32-hal-uart.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,18 @@ bool uartSetHwFlowCtrlMode(uart_t *uart, uart_hw_flowcontrol_t mode, uint8_t thr
9797
// UART_MODE_RS485_APP_CTRL = 0x04 mode: application control RS485 UART mode (used for test purposes)
9898
bool uartSetMode(uart_t *uart, uart_mode_t mode);
9999

100+
// Used to set the UART clock source mode. It must be set before calling uartBegin(), otherwise it won't have any effect.
101+
// Not all clock source are available to every SoC. The compatible option are listed here:
102+
// UART_SCLK_APB :: ESP32, ESP32-S2, ESP32-C3 and ESP32-S3
103+
// UART_SCLK_PLL_F80M :: ESP32-C5, ESP32-C6, ESP32-C61 and ESP32-P4
104+
// UART_SCLK_PLL_F40M :: ESP32-C2
105+
// UART_SCLK_PLL_F48M :: ESP32-H2
106+
// UART_SCLK_XTAL :: ESP32-C2, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2, ESP32-S3 and ESP32-P4
107+
// UART_SCLK_RTC :: ESP32-C2, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2, ESP32-S3 and ESP32-P4
108+
// UART_SCLK_REF_TICK :: ESP32 and ESP32-S2
109+
// Note: ESP32-C6, C61, ESP32-P4 and ESP32-C5 have LP UART that will use only LP_UART_SCLK_LP_FAST (RTC_FAST) or LP_UART_SCLK_XTAL_D2 (XTAL/2) as Clock Source
110+
bool uartSetClockSource(uart_t *uart, uart_sclk_t clkSrc);
111+
100112
void uartStartDetectBaudrate(uart_t *uart);
101113
unsigned long uartDetectBaudrate(uart_t *uart);
102114

0 commit comments

Comments
 (0)