Skip to content

Commit 6d72180

Browse files
authored
Add files via upload
1 parent 97a0cb1 commit 6d72180

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

cores/esp32/esp32-hal-uart.c

+16-4
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@ static bool lpuartCheckPins(int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rt
206206
}
207207
#endif // SOC_UART_LP_NUM >= 1
208208

209+
#ifndef GPIO_FUNC_IN_LOW
210+
#define GPIO_FUNC_IN_LOW GPIO_MATRIX_CONST_ZERO_INPUT
211+
#endif
212+
213+
#ifndef GPIO_FUNC_IN_HIGH
214+
#define GPIO_FUNC_IN_HIGH GPIO_MATRIX_CONST_ONE_INPUT
215+
#endif
216+
209217
// Negative Pin Number will keep it unmodified, thus this function can detach individual pins
210218
// This function will also unset the pins in the Peripheral Manager and set the pin to -1 after detaching
211219
static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin) {
@@ -221,7 +229,8 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t
221229

222230
// detaches HP and LP pins and sets Peripheral Manager and UART information
223231
if (rxPin >= 0 && uart->_rxPin == rxPin && perimanGetPinBusType(rxPin) == ESP32_BUS_TYPE_UART_RX) {
224-
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[rxPin], PIN_FUNC_GPIO);
232+
//gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[rxPin], PIN_FUNC_GPIO);
233+
esp_rom_gpio_pad_select_gpio(rxPin);
225234
// avoids causing BREAK in the UART line
226235
if (uart->_inverted) {
227236
esp_rom_gpio_connect_in_signal(GPIO_FUNC_IN_LOW, UART_PERIPH_SIGNAL(uart_num, SOC_UART_RX_PIN_IDX), false);
@@ -235,7 +244,8 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t
235244
}
236245
}
237246
if (txPin >= 0 && uart->_txPin == txPin && perimanGetPinBusType(txPin) == ESP32_BUS_TYPE_UART_TX) {
238-
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[txPin], PIN_FUNC_GPIO);
247+
//gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[txPin], PIN_FUNC_GPIO);
248+
esp_rom_gpio_pad_select_gpio(txPin);
239249
esp_rom_gpio_connect_out_signal(txPin, SIG_GPIO_OUT_IDX, false, false);
240250
uart->_txPin = -1; // -1 means unassigned/detached
241251
if (!perimanClearPinBus(txPin)) {
@@ -244,7 +254,8 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t
244254
}
245255
}
246256
if (ctsPin >= 0 && uart->_ctsPin == ctsPin && perimanGetPinBusType(ctsPin) == ESP32_BUS_TYPE_UART_CTS) {
247-
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[ctsPin], PIN_FUNC_GPIO);
257+
//gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[ctsPin], PIN_FUNC_GPIO);
258+
esp_rom_gpio_pad_select_gpio(ctsPin);
248259
esp_rom_gpio_connect_in_signal(GPIO_FUNC_IN_LOW, UART_PERIPH_SIGNAL(uart_num, SOC_UART_CTS_PIN_IDX), false);
249260
uart->_ctsPin = -1; // -1 means unassigned/detached
250261
if (!perimanClearPinBus(ctsPin)) {
@@ -253,7 +264,8 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t
253264
}
254265
}
255266
if (rtsPin >= 0 && uart->_rtsPin == rtsPin && perimanGetPinBusType(rtsPin) == ESP32_BUS_TYPE_UART_RTS) {
256-
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[rtsPin], PIN_FUNC_GPIO);
267+
//gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[rtsPin], PIN_FUNC_GPIO);
268+
esp_rom_gpio_pad_select_gpio(rtsPin);
257269
esp_rom_gpio_connect_out_signal(rtsPin, SIG_GPIO_OUT_IDX, false, false);
258270
uart->_rtsPin = -1; // -1 means unassigned/detached
259271
if (!perimanClearPinBus(rtsPin)) {

0 commit comments

Comments
 (0)