Просмотр исходного кода

gpio: enable GPIO19 on ESP32C3 boards

Omar Chebib 5 лет назад
Родитель
Сommit
5795075460

+ 2 - 1
components/driver/gpio.c

@@ -391,7 +391,8 @@ esp_err_t gpio_config(const gpio_config_t *pGPIOConfig)
                 gpio_intr_disable(io_num);
             }
 
-            PIN_FUNC_SELECT(io_reg, PIN_FUNC_GPIO); /*function number 2 is GPIO_FUNC for each pin */
+            /* By default, all the pins have to be configured as GPIO pins. */
+            PIN_FUNC_SELECT(io_reg, PIN_FUNC_GPIO);
         }
 
         io_num++;

+ 1 - 1
components/hal/include/hal/gpio_types.h

@@ -292,7 +292,7 @@ typedef enum {
     GPIO_NUM_16 = 16,   /*!< GPIO16, input and output */
     GPIO_NUM_17 = 17,   /*!< GPIO17, input and output */
     GPIO_NUM_18 = 18,   /*!< GPIO18, input and output */
-    // TODO: ESP32C3 IDF-2463
+    GPIO_NUM_19 = 19,   /*!< GPIO19, input and output */
     GPIO_NUM_20 = 20,   /*!< GPIO20, input and output */
     GPIO_NUM_21 = 21,   /*!< GPIO21, input and output */
     GPIO_NUM_22 = 22,   /*!< GPIO22, input and output */

+ 1 - 1
components/soc/esp32c3/include/soc/io_mux_reg.h

@@ -117,7 +117,7 @@
 #define IO_MUX_GPIO20_REG	PERIPHS_IO_MUX_U0RXD_U
 #define IO_MUX_GPIO21_REG	PERIPHS_IO_MUX_U0TXD_U
 
-#define FUNC_GPIO_GPIO                              1
+/* Value to set in IO Mux to use a pin as GPIO. */
 #define PIN_FUNC_GPIO								1
 
 #define GPIO_PAD_PULLUP(num) do{PIN_PULLDWN_DIS(IOMUX_REG_GPIO##num);PIN_PULLUP_EN(IOMUX_REG_GPIO##num);}while(0)