mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-01 21:29:54 +00:00
gpio: Disable USB JTAG when setting pins 18 and 19 as GPIOs on ESP32C3
When `DIS_USB_JTAG` eFuse is NOT burned (`False`), it is not possible to set pins 18 and 19 as GPIOs. This commit solves this by manually disabling USB JTAG when using pins 18 or 19. The functions shall use `gpio_hal_iomux_func_sel` instead of `PIN_FUNC_SELELECT`.
This commit is contained in:
@@ -98,6 +98,7 @@ The driver of FIFOs works as below:
|
||||
#include "driver/periph_ctrl.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "hal/sdio_slave_hal.h"
|
||||
#include "hal/gpio_hal.h"
|
||||
|
||||
|
||||
#define SDIO_SLAVE_CHECK(res, str, ret_val) do { if(!(res)){\
|
||||
@@ -280,7 +281,7 @@ static void configure_pin(int pin, uint32_t func, bool pullup)
|
||||
assert(reg != UINT32_MAX);
|
||||
|
||||
PIN_INPUT_ENABLE(reg);
|
||||
PIN_FUNC_SELECT(reg, sdmmc_func);
|
||||
gpio_hal_iomux_func_sel(reg, sdmmc_func);
|
||||
PIN_SET_DRV(reg, drive_strength);
|
||||
gpio_pulldown_dis(pin);
|
||||
if (pullup) {
|
||||
@@ -322,7 +323,7 @@ static void recover_pin(int pin, int sdio_func)
|
||||
int func = REG_GET_FIELD(reg, MCU_SEL);
|
||||
if (func == sdio_func) {
|
||||
gpio_set_direction(pin, GPIO_MODE_INPUT);
|
||||
PIN_FUNC_SELECT(reg, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(reg, PIN_FUNC_GPIO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user