1 /* 2 * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #pragma once 8 9 #include "sdkconfig.h" 10 #include "soc/soc_caps.h" 11 #include "esp_bit_defs.h" 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 typedef enum { 18 GPIO_PORT_0 = 0, 19 GPIO_PORT_MAX, 20 } gpio_port_t; 21 22 #define GPIO_PIN_REG_0 IO_MUX_GPIO0_REG 23 #define GPIO_PIN_REG_1 IO_MUX_GPIO1_REG 24 #define GPIO_PIN_REG_2 IO_MUX_GPIO2_REG 25 #define GPIO_PIN_REG_3 IO_MUX_GPIO3_REG 26 #define GPIO_PIN_REG_4 IO_MUX_GPIO4_REG 27 #define GPIO_PIN_REG_5 IO_MUX_GPIO5_REG 28 #define GPIO_PIN_REG_6 IO_MUX_GPIO6_REG 29 #define GPIO_PIN_REG_7 IO_MUX_GPIO7_REG 30 #define GPIO_PIN_REG_8 IO_MUX_GPIO8_REG 31 #define GPIO_PIN_REG_9 IO_MUX_GPIO9_REG 32 #define GPIO_PIN_REG_10 IO_MUX_GPIO10_REG 33 #define GPIO_PIN_REG_11 IO_MUX_GPIO11_REG 34 #define GPIO_PIN_REG_12 IO_MUX_GPIO12_REG 35 #define GPIO_PIN_REG_13 IO_MUX_GPIO13_REG 36 #define GPIO_PIN_REG_14 IO_MUX_GPIO14_REG 37 #define GPIO_PIN_REG_15 IO_MUX_GPIO15_REG 38 #define GPIO_PIN_REG_16 IO_MUX_GPIO16_REG 39 #define GPIO_PIN_REG_17 IO_MUX_GPIO17_REG 40 #define GPIO_PIN_REG_18 IO_MUX_GPIO18_REG 41 #define GPIO_PIN_REG_19 IO_MUX_GPIO19_REG 42 #define GPIO_PIN_REG_20 IO_MUX_GPIO20_REG 43 #define GPIO_PIN_REG_21 IO_MUX_GPIO21_REG 44 #define GPIO_PIN_REG_22 IO_MUX_GPIO22_REG 45 #define GPIO_PIN_REG_23 IO_MUX_GPIO23_REG 46 #define GPIO_PIN_REG_24 IO_MUX_GPIO24_REG 47 #define GPIO_PIN_REG_25 IO_MUX_GPIO25_REG 48 #define GPIO_PIN_REG_26 IO_MUX_GPIO26_REG 49 #define GPIO_PIN_REG_27 IO_MUX_GPIO27_REG 50 #define GPIO_PIN_REG_28 IO_MUX_GPIO28_REG 51 #define GPIO_PIN_REG_29 IO_MUX_GPIO29_REG 52 #define GPIO_PIN_REG_30 IO_MUX_GPIO30_REG 53 #define GPIO_PIN_REG_31 IO_MUX_GPIO31_REG 54 #define GPIO_PIN_REG_32 IO_MUX_GPIO32_REG 55 #define GPIO_PIN_REG_33 IO_MUX_GPIO33_REG 56 #define GPIO_PIN_REG_34 IO_MUX_GPIO34_REG 57 #define GPIO_PIN_REG_35 IO_MUX_GPIO35_REG 58 #define GPIO_PIN_REG_36 IO_MUX_GPIO36_REG 59 #define GPIO_PIN_REG_37 IO_MUX_GPIO37_REG 60 #define GPIO_PIN_REG_38 IO_MUX_GPIO38_REG 61 #define GPIO_PIN_REG_39 IO_MUX_GPIO39_REG 62 #define GPIO_PIN_REG_40 IO_MUX_GPIO40_REG 63 #define GPIO_PIN_REG_41 IO_MUX_GPIO41_REG 64 #define GPIO_PIN_REG_42 IO_MUX_GPIO42_REG 65 #define GPIO_PIN_REG_43 IO_MUX_GPIO43_REG 66 #define GPIO_PIN_REG_44 IO_MUX_GPIO44_REG 67 #define GPIO_PIN_REG_45 IO_MUX_GPIO45_REG 68 #define GPIO_PIN_REG_46 IO_MUX_GPIO46_REG 69 #define GPIO_PIN_REG_47 IO_MUX_GPIO47_REG 70 #define GPIO_PIN_REG_48 IO_MUX_GPIO48_REG 71 72 #if CONFIG_IDF_TARGET_ESP32 73 typedef enum { 74 GPIO_NUM_NC = -1, /*!< Use to signal not connected to S/W */ 75 GPIO_NUM_0 = 0, /*!< GPIO0, input and output */ 76 GPIO_NUM_1 = 1, /*!< GPIO1, input and output */ 77 GPIO_NUM_2 = 2, /*!< GPIO2, input and output */ 78 GPIO_NUM_3 = 3, /*!< GPIO3, input and output */ 79 GPIO_NUM_4 = 4, /*!< GPIO4, input and output */ 80 GPIO_NUM_5 = 5, /*!< GPIO5, input and output */ 81 GPIO_NUM_6 = 6, /*!< GPIO6, input and output */ 82 GPIO_NUM_7 = 7, /*!< GPIO7, input and output */ 83 GPIO_NUM_8 = 8, /*!< GPIO8, input and output */ 84 GPIO_NUM_9 = 9, /*!< GPIO9, input and output */ 85 GPIO_NUM_10 = 10, /*!< GPIO10, input and output */ 86 GPIO_NUM_11 = 11, /*!< GPIO11, input and output */ 87 GPIO_NUM_12 = 12, /*!< GPIO12, input and output */ 88 GPIO_NUM_13 = 13, /*!< GPIO13, input and output */ 89 GPIO_NUM_14 = 14, /*!< GPIO14, input and output */ 90 GPIO_NUM_15 = 15, /*!< GPIO15, input and output */ 91 GPIO_NUM_16 = 16, /*!< GPIO16, input and output */ 92 GPIO_NUM_17 = 17, /*!< GPIO17, input and output */ 93 GPIO_NUM_18 = 18, /*!< GPIO18, input and output */ 94 GPIO_NUM_19 = 19, /*!< GPIO19, input and output */ 95 GPIO_NUM_20 = 20, /*!< GPIO20, input and output */ 96 GPIO_NUM_21 = 21, /*!< GPIO21, input and output */ 97 GPIO_NUM_22 = 22, /*!< GPIO22, input and output */ 98 GPIO_NUM_23 = 23, /*!< GPIO23, input and output */ 99 GPIO_NUM_25 = 25, /*!< GPIO25, input and output */ 100 GPIO_NUM_26 = 26, /*!< GPIO26, input and output */ 101 GPIO_NUM_27 = 27, /*!< GPIO27, input and output */ 102 GPIO_NUM_28 = 28, /*!< GPIO28, input and output */ 103 GPIO_NUM_29 = 29, /*!< GPIO29, input and output */ 104 GPIO_NUM_30 = 30, /*!< GPIO30, input and output */ 105 GPIO_NUM_31 = 31, /*!< GPIO31, input and output */ 106 GPIO_NUM_32 = 32, /*!< GPIO32, input and output */ 107 GPIO_NUM_33 = 33, /*!< GPIO33, input and output */ 108 GPIO_NUM_34 = 34, /*!< GPIO34, input mode only */ 109 GPIO_NUM_35 = 35, /*!< GPIO35, input mode only */ 110 GPIO_NUM_36 = 36, /*!< GPIO36, input mode only */ 111 GPIO_NUM_37 = 37, /*!< GPIO37, input mode only */ 112 GPIO_NUM_38 = 38, /*!< GPIO38, input mode only */ 113 GPIO_NUM_39 = 39, /*!< GPIO39, input mode only */ 114 GPIO_NUM_MAX, 115 /** @endcond */ 116 } gpio_num_t; 117 #elif CONFIG_IDF_TARGET_ESP32S2 118 typedef enum { 119 GPIO_NUM_NC = -1, /*!< Use to signal not connected to S/W */ 120 GPIO_NUM_0 = 0, /*!< GPIO0, input and output */ 121 GPIO_NUM_1 = 1, /*!< GPIO1, input and output */ 122 GPIO_NUM_2 = 2, /*!< GPIO2, input and output */ 123 GPIO_NUM_3 = 3, /*!< GPIO3, input and output */ 124 GPIO_NUM_4 = 4, /*!< GPIO4, input and output */ 125 GPIO_NUM_5 = 5, /*!< GPIO5, input and output */ 126 GPIO_NUM_6 = 6, /*!< GPIO6, input and output */ 127 GPIO_NUM_7 = 7, /*!< GPIO7, input and output */ 128 GPIO_NUM_8 = 8, /*!< GPIO8, input and output */ 129 GPIO_NUM_9 = 9, /*!< GPIO9, input and output */ 130 GPIO_NUM_10 = 10, /*!< GPIO10, input and output */ 131 GPIO_NUM_11 = 11, /*!< GPIO11, input and output */ 132 GPIO_NUM_12 = 12, /*!< GPIO12, input and output */ 133 GPIO_NUM_13 = 13, /*!< GPIO13, input and output */ 134 GPIO_NUM_14 = 14, /*!< GPIO14, input and output */ 135 GPIO_NUM_15 = 15, /*!< GPIO15, input and output */ 136 GPIO_NUM_16 = 16, /*!< GPIO16, input and output */ 137 GPIO_NUM_17 = 17, /*!< GPIO17, input and output */ 138 GPIO_NUM_18 = 18, /*!< GPIO18, input and output */ 139 GPIO_NUM_19 = 19, /*!< GPIO19, input and output */ 140 GPIO_NUM_20 = 20, /*!< GPIO20, input and output */ 141 GPIO_NUM_21 = 21, /*!< GPIO21, input and output */ 142 GPIO_NUM_26 = 26, /*!< GPIO26, input and output */ 143 GPIO_NUM_27 = 27, /*!< GPIO27, input and output */ 144 GPIO_NUM_28 = 28, /*!< GPIO28, input and output */ 145 GPIO_NUM_29 = 29, /*!< GPIO29, input and output */ 146 GPIO_NUM_30 = 30, /*!< GPIO30, input and output */ 147 GPIO_NUM_31 = 31, /*!< GPIO31, input and output */ 148 GPIO_NUM_32 = 32, /*!< GPIO32, input and output */ 149 GPIO_NUM_33 = 33, /*!< GPIO33, input and output */ 150 GPIO_NUM_34 = 34, /*!< GPIO34, input and output */ 151 GPIO_NUM_35 = 35, /*!< GPIO35, input and output */ 152 GPIO_NUM_36 = 36, /*!< GPIO36, input and output */ 153 GPIO_NUM_37 = 37, /*!< GPIO37, input and output */ 154 GPIO_NUM_38 = 38, /*!< GPIO38, input and output */ 155 GPIO_NUM_39 = 39, /*!< GPIO39, input and output */ 156 GPIO_NUM_40 = 40, /*!< GPIO40, input and output */ 157 GPIO_NUM_41 = 41, /*!< GPIO41, input and output */ 158 GPIO_NUM_42 = 42, /*!< GPIO42, input and output */ 159 GPIO_NUM_43 = 43, /*!< GPIO43, input and output */ 160 GPIO_NUM_44 = 44, /*!< GPIO44, input and output */ 161 GPIO_NUM_45 = 45, /*!< GPIO45, input and output */ 162 GPIO_NUM_46 = 46, /*!< GPIO46, input mode only */ 163 GPIO_NUM_MAX, 164 /** @endcond */ 165 } gpio_num_t; 166 #elif CONFIG_IDF_TARGET_ESP32S3 167 typedef enum { 168 GPIO_NUM_NC = -1, /*!< Use to signal not connected to S/W */ 169 GPIO_NUM_0 = 0, /*!< GPIO0, input and output */ 170 GPIO_NUM_1 = 1, /*!< GPIO1, input and output */ 171 GPIO_NUM_2 = 2, /*!< GPIO2, input and output */ 172 GPIO_NUM_3 = 3, /*!< GPIO3, input and output */ 173 GPIO_NUM_4 = 4, /*!< GPIO4, input and output */ 174 GPIO_NUM_5 = 5, /*!< GPIO5, input and output */ 175 GPIO_NUM_6 = 6, /*!< GPIO6, input and output */ 176 GPIO_NUM_7 = 7, /*!< GPIO7, input and output */ 177 GPIO_NUM_8 = 8, /*!< GPIO8, input and output */ 178 GPIO_NUM_9 = 9, /*!< GPIO9, input and output */ 179 GPIO_NUM_10 = 10, /*!< GPIO10, input and output */ 180 GPIO_NUM_11 = 11, /*!< GPIO11, input and output */ 181 GPIO_NUM_12 = 12, /*!< GPIO12, input and output */ 182 GPIO_NUM_13 = 13, /*!< GPIO13, input and output */ 183 GPIO_NUM_14 = 14, /*!< GPIO14, input and output */ 184 GPIO_NUM_15 = 15, /*!< GPIO15, input and output */ 185 GPIO_NUM_16 = 16, /*!< GPIO16, input and output */ 186 GPIO_NUM_17 = 17, /*!< GPIO17, input and output */ 187 GPIO_NUM_18 = 18, /*!< GPIO18, input and output */ 188 GPIO_NUM_19 = 19, /*!< GPIO19, input and output */ 189 GPIO_NUM_20 = 20, /*!< GPIO20, input and output */ 190 GPIO_NUM_21 = 21, /*!< GPIO21, input and output */ 191 GPIO_NUM_26 = 26, /*!< GPIO26, input and output */ 192 GPIO_NUM_27 = 27, /*!< GPIO27, input and output */ 193 GPIO_NUM_28 = 28, /*!< GPIO28, input and output */ 194 GPIO_NUM_29 = 29, /*!< GPIO29, input and output */ 195 GPIO_NUM_30 = 30, /*!< GPIO30, input and output */ 196 GPIO_NUM_31 = 31, /*!< GPIO31, input and output */ 197 GPIO_NUM_32 = 32, /*!< GPIO32, input and output */ 198 GPIO_NUM_33 = 33, /*!< GPIO33, input and output */ 199 GPIO_NUM_34 = 34, /*!< GPIO34, input and output */ 200 GPIO_NUM_35 = 35, /*!< GPIO35, input and output */ 201 GPIO_NUM_36 = 36, /*!< GPIO36, input and output */ 202 GPIO_NUM_37 = 37, /*!< GPIO37, input and output */ 203 GPIO_NUM_38 = 38, /*!< GPIO38, input and output */ 204 GPIO_NUM_39 = 39, /*!< GPIO39, input and output */ 205 GPIO_NUM_40 = 40, /*!< GPIO40, input and output */ 206 GPIO_NUM_41 = 41, /*!< GPIO41, input and output */ 207 GPIO_NUM_42 = 42, /*!< GPIO42, input and output */ 208 GPIO_NUM_43 = 43, /*!< GPIO43, input and output */ 209 GPIO_NUM_44 = 44, /*!< GPIO44, input and output */ 210 GPIO_NUM_45 = 45, /*!< GPIO45, input and output */ 211 GPIO_NUM_46 = 46, /*!< GPIO46, input and output */ 212 GPIO_NUM_47 = 47, /*!< GPIO47, input and output */ 213 GPIO_NUM_48 = 48, /*!< GPIO48, input and output */ 214 GPIO_NUM_MAX, 215 /** @endcond */ 216 } gpio_num_t; 217 #elif CONFIG_IDF_TARGET_ESP32C3 218 typedef enum { 219 GPIO_NUM_NC = -1, /*!< Use to signal not connected to S/W */ 220 GPIO_NUM_0 = 0, /*!< GPIO0, input and output */ 221 GPIO_NUM_1 = 1, /*!< GPIO1, input and output */ 222 GPIO_NUM_2 = 2, /*!< GPIO2, input and output */ 223 GPIO_NUM_3 = 3, /*!< GPIO3, input and output */ 224 GPIO_NUM_4 = 4, /*!< GPIO4, input and output */ 225 GPIO_NUM_5 = 5, /*!< GPIO5, input and output */ 226 GPIO_NUM_6 = 6, /*!< GPIO6, input and output */ 227 GPIO_NUM_7 = 7, /*!< GPIO7, input and output */ 228 GPIO_NUM_8 = 8, /*!< GPIO8, input and output */ 229 GPIO_NUM_9 = 9, /*!< GPIO9, input and output */ 230 GPIO_NUM_10 = 10, /*!< GPIO10, input and output */ 231 GPIO_NUM_11 = 11, /*!< GPIO11, input and output */ 232 GPIO_NUM_12 = 12, /*!< GPIO12, input and output */ 233 GPIO_NUM_13 = 13, /*!< GPIO13, input and output */ 234 GPIO_NUM_14 = 14, /*!< GPIO14, input and output */ 235 GPIO_NUM_15 = 15, /*!< GPIO15, input and output */ 236 GPIO_NUM_16 = 16, /*!< GPIO16, input and output */ 237 GPIO_NUM_17 = 17, /*!< GPIO17, input and output */ 238 GPIO_NUM_18 = 18, /*!< GPIO18, input and output */ 239 GPIO_NUM_19 = 19, /*!< GPIO19, input and output */ 240 GPIO_NUM_20 = 20, /*!< GPIO20, input and output */ 241 GPIO_NUM_21 = 21, /*!< GPIO21, input and output */ 242 GPIO_NUM_MAX, 243 /** @endcond */ 244 } gpio_num_t; 245 #elif CONFIG_IDF_TARGET_ESP32C2 246 typedef enum { 247 GPIO_NUM_NC = -1, /*!< Use to signal not connected to S/W */ 248 GPIO_NUM_0 = 0, /*!< GPIO0, input and output */ 249 GPIO_NUM_1 = 1, /*!< GPIO1, input and output */ 250 GPIO_NUM_2 = 2, /*!< GPIO2, input and output */ 251 GPIO_NUM_3 = 3, /*!< GPIO3, input and output */ 252 GPIO_NUM_4 = 4, /*!< GPIO4, input and output */ 253 GPIO_NUM_5 = 5, /*!< GPIO5, input and output */ 254 GPIO_NUM_6 = 6, /*!< GPIO6, input and output */ 255 GPIO_NUM_7 = 7, /*!< GPIO7, input and output */ 256 GPIO_NUM_8 = 8, /*!< GPIO8, input and output */ 257 GPIO_NUM_9 = 9, /*!< GPIO9, input and output */ 258 GPIO_NUM_10 = 10, /*!< GPIO10, input and output */ 259 GPIO_NUM_11 = 11, /*!< GPIO11, input and output */ 260 GPIO_NUM_12 = 12, /*!< GPIO12, input and output */ 261 GPIO_NUM_13 = 13, /*!< GPIO13, input and output */ 262 GPIO_NUM_14 = 14, /*!< GPIO14, input and output */ 263 GPIO_NUM_15 = 15, /*!< GPIO15, input and output */ 264 GPIO_NUM_16 = 16, /*!< GPIO16, input and output */ 265 GPIO_NUM_17 = 17, /*!< GPIO17, input and output */ 266 GPIO_NUM_18 = 18, /*!< GPIO18, input and output */ 267 GPIO_NUM_19 = 19, /*!< GPIO19, input and output */ 268 GPIO_NUM_20 = 20, /*!< GPIO20, input and output */ 269 GPIO_NUM_MAX, 270 /** @endcond */ 271 } gpio_num_t; 272 #elif CONFIG_IDF_TARGET_ESP32C6 273 typedef enum { 274 GPIO_NUM_NC = -1, /*!< Use to signal not connected to S/W */ 275 GPIO_NUM_0 = 0, /*!< GPIO0, input and output */ 276 GPIO_NUM_1 = 1, /*!< GPIO1, input and output */ 277 GPIO_NUM_2 = 2, /*!< GPIO2, input and output */ 278 GPIO_NUM_3 = 3, /*!< GPIO3, input and output */ 279 GPIO_NUM_4 = 4, /*!< GPIO4, input and output */ 280 GPIO_NUM_5 = 5, /*!< GPIO5, input and output */ 281 GPIO_NUM_6 = 6, /*!< GPIO6, input and output */ 282 GPIO_NUM_7 = 7, /*!< GPIO7, input and output */ 283 GPIO_NUM_8 = 8, /*!< GPIO8, input and output */ 284 GPIO_NUM_9 = 9, /*!< GPIO9, input and output */ 285 GPIO_NUM_10 = 10, /*!< GPIO10, input and output */ 286 GPIO_NUM_11 = 11, /*!< GPIO11, input and output */ 287 GPIO_NUM_12 = 12, /*!< GPIO12, input and output */ 288 GPIO_NUM_13 = 13, /*!< GPIO13, input and output */ 289 GPIO_NUM_14 = 14, /*!< GPIO14, input and output */ 290 GPIO_NUM_15 = 15, /*!< GPIO15, input and output */ 291 GPIO_NUM_16 = 16, /*!< GPIO16, input and output */ 292 GPIO_NUM_17 = 17, /*!< GPIO17, input and output */ 293 GPIO_NUM_18 = 18, /*!< GPIO18, input and output */ 294 GPIO_NUM_19 = 19, /*!< GPIO19, input and output */ 295 GPIO_NUM_20 = 20, /*!< GPIO20, input and output */ 296 GPIO_NUM_21 = 21, /*!< GPIO21, input and output */ 297 GPIO_NUM_22 = 22, /*!< GPIO22, input and output */ 298 GPIO_NUM_23 = 23, /*!< GPIO23, input and output */ 299 GPIO_NUM_24 = 24, /*!< GPIO24, input and output */ 300 GPIO_NUM_25 = 25, /*!< GPIO25, input and output */ 301 GPIO_NUM_26 = 26, /*!< GPIO26, input and output */ 302 GPIO_NUM_27 = 27, /*!< GPIO27, input and output */ 303 GPIO_NUM_28 = 28, /*!< GPIO28, input and output */ 304 GPIO_NUM_29 = 29, /*!< GPIO29, input and output */ 305 GPIO_NUM_30 = 30, /*!< GPIO30, input and output */ 306 GPIO_NUM_MAX, 307 /** @endcond */ 308 } gpio_num_t; 309 #elif CONFIG_IDF_TARGET_ESP32H2 310 typedef enum { 311 GPIO_NUM_NC = -1, /*!< Use to signal not connected to S/W */ 312 GPIO_NUM_0 = 0, /*!< GPIO0, input and output */ 313 GPIO_NUM_1 = 1, /*!< GPIO1, input and output */ 314 GPIO_NUM_2 = 2, /*!< GPIO2, input and output */ 315 GPIO_NUM_3 = 3, /*!< GPIO3, input and output */ 316 GPIO_NUM_4 = 4, /*!< GPIO4, input and output */ 317 GPIO_NUM_5 = 5, /*!< GPIO5, input and output */ 318 GPIO_NUM_6 = 6, /*!< GPIO6, input and output */ 319 GPIO_NUM_7 = 7, /*!< GPIO7, input and output */ 320 GPIO_NUM_8 = 8, /*!< GPIO8, input and output */ 321 GPIO_NUM_9 = 9, /*!< GPIO9, input and output */ 322 GPIO_NUM_10 = 10, /*!< GPIO10, input and output */ 323 GPIO_NUM_11 = 11, /*!< GPIO11, input and output */ 324 GPIO_NUM_12 = 12, /*!< GPIO12, input and output */ 325 GPIO_NUM_13 = 13, /*!< GPIO13, input and output */ 326 GPIO_NUM_14 = 14, /*!< GPIO14, input and output */ 327 GPIO_NUM_15 = 15, /*!< GPIO15, input and output */ 328 GPIO_NUM_16 = 16, /*!< GPIO16, input and output */ 329 GPIO_NUM_17 = 17, /*!< GPIO17, input and output */ 330 GPIO_NUM_18 = 18, /*!< GPIO18, input and output */ 331 GPIO_NUM_19 = 19, /*!< GPIO19, input and output */ 332 GPIO_NUM_20 = 20, /*!< GPIO20, input and output */ 333 GPIO_NUM_21 = 21, /*!< GPIO21, input and output */ 334 GPIO_NUM_22 = 22, /*!< GPIO22, input and output */ 335 GPIO_NUM_23 = 23, /*!< GPIO23, input and output */ 336 GPIO_NUM_24 = 24, /*!< GPIO24, input and output */ 337 GPIO_NUM_25 = 25, /*!< GPIO25, input and output */ 338 GPIO_NUM_26 = 26, /*!< GPIO26, input and output */ 339 GPIO_NUM_27 = 27, /*!< GPIO27, input and output */ 340 GPIO_NUM_MAX, 341 /** @endcond */ 342 } gpio_num_t; 343 #endif 344 345 typedef enum { 346 GPIO_INTR_DISABLE = 0, /*!< Disable GPIO interrupt */ 347 GPIO_INTR_POSEDGE = 1, /*!< GPIO interrupt type : rising edge */ 348 GPIO_INTR_NEGEDGE = 2, /*!< GPIO interrupt type : falling edge */ 349 GPIO_INTR_ANYEDGE = 3, /*!< GPIO interrupt type : both rising and falling edge */ 350 GPIO_INTR_LOW_LEVEL = 4, /*!< GPIO interrupt type : input low level trigger */ 351 GPIO_INTR_HIGH_LEVEL = 5, /*!< GPIO interrupt type : input high level trigger */ 352 GPIO_INTR_MAX, 353 } gpio_int_type_t; 354 355 /** @cond */ 356 #define GPIO_MODE_DEF_DISABLE (0) 357 #define GPIO_MODE_DEF_INPUT (BIT0) ///< bit mask for input 358 #define GPIO_MODE_DEF_OUTPUT (BIT1) ///< bit mask for output 359 #define GPIO_MODE_DEF_OD (BIT2) ///< bit mask for OD mode 360 /** @endcond */ 361 362 typedef enum { 363 GPIO_MODE_DISABLE = GPIO_MODE_DEF_DISABLE, /*!< GPIO mode : disable input and output */ 364 GPIO_MODE_INPUT = GPIO_MODE_DEF_INPUT, /*!< GPIO mode : input only */ 365 GPIO_MODE_OUTPUT = GPIO_MODE_DEF_OUTPUT, /*!< GPIO mode : output only mode */ 366 GPIO_MODE_OUTPUT_OD = ((GPIO_MODE_DEF_OUTPUT) | (GPIO_MODE_DEF_OD)), /*!< GPIO mode : output only with open-drain mode */ 367 GPIO_MODE_INPUT_OUTPUT_OD = ((GPIO_MODE_DEF_INPUT) | (GPIO_MODE_DEF_OUTPUT) | (GPIO_MODE_DEF_OD)), /*!< GPIO mode : output and input with open-drain mode*/ 368 GPIO_MODE_INPUT_OUTPUT = ((GPIO_MODE_DEF_INPUT) | (GPIO_MODE_DEF_OUTPUT)), /*!< GPIO mode : output and input mode */ 369 } gpio_mode_t; 370 371 typedef enum { 372 GPIO_PULLUP_DISABLE = 0x0, /*!< Disable GPIO pull-up resistor */ 373 GPIO_PULLUP_ENABLE = 0x1, /*!< Enable GPIO pull-up resistor */ 374 } gpio_pullup_t; 375 376 typedef enum { 377 GPIO_PULLDOWN_DISABLE = 0x0, /*!< Disable GPIO pull-down resistor */ 378 GPIO_PULLDOWN_ENABLE = 0x1, /*!< Enable GPIO pull-down resistor */ 379 } gpio_pulldown_t; 380 381 typedef enum { 382 GPIO_PULLUP_ONLY, /*!< Pad pull up */ 383 GPIO_PULLDOWN_ONLY, /*!< Pad pull down */ 384 GPIO_PULLUP_PULLDOWN, /*!< Pad pull up + pull down*/ 385 GPIO_FLOATING, /*!< Pad floating */ 386 } gpio_pull_mode_t; 387 388 typedef enum { 389 GPIO_DRIVE_CAP_0 = 0, /*!< Pad drive capability: weak */ 390 GPIO_DRIVE_CAP_1 = 1, /*!< Pad drive capability: stronger */ 391 GPIO_DRIVE_CAP_2 = 2, /*!< Pad drive capability: medium */ 392 GPIO_DRIVE_CAP_DEFAULT = 2, /*!< Pad drive capability: medium */ 393 GPIO_DRIVE_CAP_3 = 3, /*!< Pad drive capability: strongest */ 394 GPIO_DRIVE_CAP_MAX, 395 } gpio_drive_cap_t; 396 397 /** 398 * @brief Available option for configuring hysteresis feature of GPIOs 399 */ 400 typedef enum { 401 GPIO_HYS_CTRL_EFUSE = 0, /*!< Pad input hysteresis ctrl by efuse */ 402 GPIO_HYS_SOFT_ENABLE = 1, /*!< Pad input hysteresis enable by software */ 403 GPIO_HYS_SOFT_DISABLE = 2, /*!< Pad input hysteresis disable by software */ 404 } gpio_hys_ctrl_mode_t; 405 406 #ifdef __cplusplus 407 } 408 #endif 409