gpio.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. /*
  2. * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdio.h>
  8. #include <stdbool.h>
  9. #include "sdkconfig.h"
  10. #include "esp_err.h"
  11. #include "esp_intr_alloc.h"
  12. #include "soc/soc_caps.h"
  13. #include "hal/gpio_types.h"
  14. #include "esp_rom_gpio.h"
  15. #include "driver/gpio_etm.h"
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. #define GPIO_PIN_COUNT (SOC_GPIO_PIN_COUNT)
  20. /// Check whether it is a valid GPIO number
  21. #define GPIO_IS_VALID_GPIO(gpio_num) ((gpio_num >= 0) && \
  22. (((1ULL << (gpio_num)) & SOC_GPIO_VALID_GPIO_MASK) != 0))
  23. /// Check whether it can be a valid GPIO number of output mode
  24. #define GPIO_IS_VALID_OUTPUT_GPIO(gpio_num) ((gpio_num >= 0) && \
  25. (((1ULL << (gpio_num)) & SOC_GPIO_VALID_OUTPUT_GPIO_MASK) != 0))
  26. /// Check whether it can be a valid digital I/O pad
  27. #define GPIO_IS_VALID_DIGITAL_IO_PAD(gpio_num) ((gpio_num >= 0) && \
  28. (((1ULL << (gpio_num)) & SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK) != 0))
  29. typedef intr_handle_t gpio_isr_handle_t;
  30. /**
  31. * @brief GPIO interrupt handler
  32. *
  33. * @param arg User registered data
  34. */
  35. typedef void (*gpio_isr_t)(void *arg);
  36. /**
  37. * @brief Configuration parameters of GPIO pad for gpio_config function
  38. */
  39. typedef struct {
  40. uint64_t pin_bit_mask; /*!< GPIO pin: set with bit mask, each bit maps to a GPIO */
  41. gpio_mode_t mode; /*!< GPIO mode: set input/output mode */
  42. gpio_pullup_t pull_up_en; /*!< GPIO pull-up */
  43. gpio_pulldown_t pull_down_en; /*!< GPIO pull-down */
  44. gpio_int_type_t intr_type; /*!< GPIO interrupt type */
  45. #if SOC_GPIO_SUPPORT_PIN_HYS_FILTER
  46. gpio_hys_ctrl_mode_t hys_ctrl_mode; /*!< GPIO hysteresis: hysteresis filter on slope input */
  47. #endif
  48. } gpio_config_t;
  49. /**
  50. * @brief GPIO common configuration
  51. *
  52. * Configure GPIO's Mode,pull-up,PullDown,IntrType
  53. *
  54. * @param pGPIOConfig Pointer to GPIO configure struct
  55. *
  56. * @return
  57. * - ESP_OK success
  58. * - ESP_ERR_INVALID_ARG Parameter error
  59. *
  60. */
  61. esp_err_t gpio_config(const gpio_config_t *pGPIOConfig);
  62. /**
  63. * @brief Reset an gpio to default state (select gpio function, enable pullup and disable input and output).
  64. *
  65. * @param gpio_num GPIO number.
  66. *
  67. * @note This function also configures the IOMUX for this pin to the GPIO
  68. * function, and disconnects any other peripheral output configured via GPIO
  69. * Matrix.
  70. *
  71. * @return Always return ESP_OK.
  72. */
  73. esp_err_t gpio_reset_pin(gpio_num_t gpio_num);
  74. /**
  75. * @brief GPIO set interrupt trigger type
  76. *
  77. * @param gpio_num GPIO number. If you want to set the trigger type of e.g. of GPIO16, gpio_num should be GPIO_NUM_16 (16);
  78. * @param intr_type Interrupt type, select from gpio_int_type_t
  79. *
  80. * @return
  81. * - ESP_OK Success
  82. * - ESP_ERR_INVALID_ARG Parameter error
  83. *
  84. */
  85. esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type);
  86. /**
  87. * @brief Enable GPIO module interrupt signal
  88. *
  89. * @note ESP32: Please do not use the interrupt of GPIO36 and GPIO39 when using ADC or Wi-Fi and Bluetooth with sleep mode enabled.
  90. * Please refer to the comments of `adc1_get_raw`.
  91. * Please refer to Section 3.11 of <a href="https://espressif.com/sites/default/files/documentation/eco_and_workarounds_for_bugs_in_esp32_en.pdf">ESP32 ECO and Workarounds for Bugs</a> for the description of this issue.
  92. *
  93. * @param gpio_num GPIO number. If you want to enable an interrupt on e.g. GPIO16, gpio_num should be GPIO_NUM_16 (16);
  94. *
  95. * @return
  96. * - ESP_OK Success
  97. * - ESP_ERR_INVALID_ARG Parameter error
  98. *
  99. */
  100. esp_err_t gpio_intr_enable(gpio_num_t gpio_num);
  101. /**
  102. * @brief Disable GPIO module interrupt signal
  103. *
  104. * @note This function is allowed to be executed when Cache is disabled within ISR context, by enabling `CONFIG_GPIO_CTRL_FUNC_IN_IRAM`
  105. *
  106. * @param gpio_num GPIO number. If you want to disable the interrupt of e.g. GPIO16, gpio_num should be GPIO_NUM_16 (16);
  107. *
  108. * @return
  109. * - ESP_OK success
  110. * - ESP_ERR_INVALID_ARG Parameter error
  111. *
  112. */
  113. esp_err_t gpio_intr_disable(gpio_num_t gpio_num);
  114. /**
  115. * @brief GPIO set output level
  116. *
  117. * @note This function is allowed to be executed when Cache is disabled within ISR context, by enabling `CONFIG_GPIO_CTRL_FUNC_IN_IRAM`
  118. *
  119. * @param gpio_num GPIO number. If you want to set the output level of e.g. GPIO16, gpio_num should be GPIO_NUM_16 (16);
  120. * @param level Output level. 0: low ; 1: high
  121. *
  122. * @return
  123. * - ESP_OK Success
  124. * - ESP_ERR_INVALID_ARG GPIO number error
  125. *
  126. */
  127. esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level);
  128. /**
  129. * @brief GPIO get input level
  130. *
  131. * @warning If the pad is not configured for input (or input and output) the returned value is always 0.
  132. *
  133. * @param gpio_num GPIO number. If you want to get the logic level of e.g. pin GPIO16, gpio_num should be GPIO_NUM_16 (16);
  134. *
  135. * @return
  136. * - 0 the GPIO input level is 0
  137. * - 1 the GPIO input level is 1
  138. *
  139. */
  140. int gpio_get_level(gpio_num_t gpio_num);
  141. /**
  142. * @brief GPIO set direction
  143. *
  144. * Configure GPIO direction,such as output_only,input_only,output_and_input
  145. *
  146. * @param gpio_num Configure GPIO pins number, it should be GPIO number. If you want to set direction of e.g. GPIO16, gpio_num should be GPIO_NUM_16 (16);
  147. * @param mode GPIO direction
  148. *
  149. * @return
  150. * - ESP_OK Success
  151. * - ESP_ERR_INVALID_ARG GPIO error
  152. *
  153. */
  154. esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_mode_t mode);
  155. /**
  156. * @brief Configure GPIO pull-up/pull-down resistors
  157. *
  158. * @note ESP32: Only pins that support both input & output have integrated pull-up and pull-down resistors. Input-only GPIOs 34-39 do not.
  159. *
  160. * @param gpio_num GPIO number. If you want to set pull up or down mode for e.g. GPIO16, gpio_num should be GPIO_NUM_16 (16);
  161. * @param pull GPIO pull up/down mode.
  162. *
  163. * @return
  164. * - ESP_OK Success
  165. * - ESP_ERR_INVALID_ARG : Parameter error
  166. *
  167. */
  168. esp_err_t gpio_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull);
  169. /**
  170. * @brief Enable GPIO wake-up function.
  171. *
  172. * @param gpio_num GPIO number.
  173. *
  174. * @param intr_type GPIO wake-up type. Only GPIO_INTR_LOW_LEVEL or GPIO_INTR_HIGH_LEVEL can be used.
  175. *
  176. * @return
  177. * - ESP_OK Success
  178. * - ESP_ERR_INVALID_ARG Parameter error
  179. */
  180. esp_err_t gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type);
  181. /**
  182. * @brief Disable GPIO wake-up function.
  183. *
  184. * @param gpio_num GPIO number
  185. *
  186. * @return
  187. * - ESP_OK Success
  188. * - ESP_ERR_INVALID_ARG Parameter error
  189. */
  190. esp_err_t gpio_wakeup_disable(gpio_num_t gpio_num);
  191. /**
  192. * @brief Register GPIO interrupt handler, the handler is an ISR.
  193. * The handler will be attached to the same CPU core that this function is running on.
  194. *
  195. * This ISR function is called whenever any GPIO interrupt occurs. See
  196. * the alternative gpio_install_isr_service() and
  197. * gpio_isr_handler_add() API in order to have the driver support
  198. * per-GPIO ISRs.
  199. *
  200. * @param fn Interrupt handler function.
  201. * @param arg Parameter for handler function
  202. * @param intr_alloc_flags Flags used to allocate the interrupt. One or multiple (ORred)
  203. * ESP_INTR_FLAG_* values. See esp_intr_alloc.h for more info.
  204. * @param handle Pointer to return handle. If non-NULL, a handle for the interrupt will be returned here.
  205. *
  206. * \verbatim embed:rst:leading-asterisk
  207. * To disable or remove the ISR, pass the returned handle to the :doc:`interrupt allocation functions </api-reference/system/intr_alloc>`.
  208. * \endverbatim
  209. *
  210. * @return
  211. * - ESP_OK Success ;
  212. * - ESP_ERR_INVALID_ARG GPIO error
  213. * - ESP_ERR_NOT_FOUND No free interrupt found with the specified flags
  214. */
  215. esp_err_t gpio_isr_register(void (*fn)(void *), void *arg, int intr_alloc_flags, gpio_isr_handle_t *handle);
  216. /**
  217. * @brief Enable pull-up on GPIO.
  218. *
  219. * @param gpio_num GPIO number
  220. *
  221. * @return
  222. * - ESP_OK Success
  223. * - ESP_ERR_INVALID_ARG Parameter error
  224. */
  225. esp_err_t gpio_pullup_en(gpio_num_t gpio_num);
  226. /**
  227. * @brief Disable pull-up on GPIO.
  228. *
  229. * @param gpio_num GPIO number
  230. *
  231. * @return
  232. * - ESP_OK Success
  233. * - ESP_ERR_INVALID_ARG Parameter error
  234. */
  235. esp_err_t gpio_pullup_dis(gpio_num_t gpio_num);
  236. /**
  237. * @brief Enable pull-down on GPIO.
  238. *
  239. * @param gpio_num GPIO number
  240. *
  241. * @return
  242. * - ESP_OK Success
  243. * - ESP_ERR_INVALID_ARG Parameter error
  244. */
  245. esp_err_t gpio_pulldown_en(gpio_num_t gpio_num);
  246. /**
  247. * @brief Disable pull-down on GPIO.
  248. *
  249. * @param gpio_num GPIO number
  250. *
  251. * @return
  252. * - ESP_OK Success
  253. * - ESP_ERR_INVALID_ARG Parameter error
  254. */
  255. esp_err_t gpio_pulldown_dis(gpio_num_t gpio_num);
  256. /**
  257. * @brief Install the GPIO driver's ETS_GPIO_INTR_SOURCE ISR handler service, which allows per-pin GPIO interrupt handlers.
  258. *
  259. * This function is incompatible with gpio_isr_register() - if that function is used, a single global ISR is registered for all GPIO interrupts. If this function is used, the ISR service provides a global GPIO ISR and individual pin handlers are registered via the gpio_isr_handler_add() function.
  260. *
  261. * @param intr_alloc_flags Flags used to allocate the interrupt. One or multiple (ORred)
  262. * ESP_INTR_FLAG_* values. See esp_intr_alloc.h for more info.
  263. *
  264. * @return
  265. * - ESP_OK Success
  266. * - ESP_ERR_NO_MEM No memory to install this service
  267. * - ESP_ERR_INVALID_STATE ISR service already installed.
  268. * - ESP_ERR_NOT_FOUND No free interrupt found with the specified flags
  269. * - ESP_ERR_INVALID_ARG GPIO error
  270. */
  271. esp_err_t gpio_install_isr_service(int intr_alloc_flags);
  272. /**
  273. * @brief Uninstall the driver's GPIO ISR service, freeing related resources.
  274. */
  275. void gpio_uninstall_isr_service(void);
  276. /**
  277. * @brief Add ISR handler for the corresponding GPIO pin.
  278. *
  279. * Call this function after using gpio_install_isr_service() to
  280. * install the driver's GPIO ISR handler service.
  281. *
  282. * The pin ISR handlers no longer need to be declared with IRAM_ATTR,
  283. * unless you pass the ESP_INTR_FLAG_IRAM flag when allocating the
  284. * ISR in gpio_install_isr_service().
  285. *
  286. * This ISR handler will be called from an ISR. So there is a stack
  287. * size limit (configurable as "ISR stack size" in menuconfig). This
  288. * limit is smaller compared to a global GPIO interrupt handler due
  289. * to the additional level of indirection.
  290. *
  291. * @param gpio_num GPIO number
  292. * @param isr_handler ISR handler function for the corresponding GPIO number.
  293. * @param args parameter for ISR handler.
  294. *
  295. * @return
  296. * - ESP_OK Success
  297. * - ESP_ERR_INVALID_STATE Wrong state, the ISR service has not been initialized.
  298. * - ESP_ERR_INVALID_ARG Parameter error
  299. */
  300. esp_err_t gpio_isr_handler_add(gpio_num_t gpio_num, gpio_isr_t isr_handler, void *args);
  301. /**
  302. * @brief Remove ISR handler for the corresponding GPIO pin.
  303. *
  304. * @param gpio_num GPIO number
  305. *
  306. * @return
  307. * - ESP_OK Success
  308. * - ESP_ERR_INVALID_STATE Wrong state, the ISR service has not been initialized.
  309. * - ESP_ERR_INVALID_ARG Parameter error
  310. */
  311. esp_err_t gpio_isr_handler_remove(gpio_num_t gpio_num);
  312. /**
  313. * @brief Set GPIO pad drive capability
  314. *
  315. * @param gpio_num GPIO number, only support output GPIOs
  316. * @param strength Drive capability of the pad
  317. *
  318. * @return
  319. * - ESP_OK Success
  320. * - ESP_ERR_INVALID_ARG Parameter error
  321. */
  322. esp_err_t gpio_set_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t strength);
  323. /**
  324. * @brief Get GPIO pad drive capability
  325. *
  326. * @param gpio_num GPIO number, only support output GPIOs
  327. * @param strength Pointer to accept drive capability of the pad
  328. *
  329. * @return
  330. * - ESP_OK Success
  331. * - ESP_ERR_INVALID_ARG Parameter error
  332. */
  333. esp_err_t gpio_get_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t *strength);
  334. /**
  335. * @brief Enable gpio pad hold function.
  336. *
  337. * When a GPIO is set to hold, its state is latched at that moment and will not change when the internal
  338. * signal or the IO MUX/GPIO configuration is modified (including input enable, output enable, output value,
  339. * function, and drive strength values). This function can be used to retain the state of GPIOs when the chip
  340. * or system is reset, for example, when watchdog time-out or Deep-sleep events are triggered.
  341. *
  342. * This function works in both input and output modes, and only applicable to output-capable GPIOs.
  343. * If this function is enabled:
  344. * in output mode: the output level of the GPIO will be locked and can not be changed.
  345. * in input mode: the input read value can still reflect the changes of the input signal.
  346. *
  347. * However, on ESP32/S2/C3/S3/C2, this function cannot be used to hold the state of a digital GPIO during Deep-sleep.
  348. * Even if this function is enabled, the digital GPIO will be reset to its default state when the chip wakes up from
  349. * Deep-sleep. If you want to hold the state of a digital GPIO during Deep-sleep, please call `gpio_deep_sleep_hold_en`.
  350. *
  351. * Power down or call `gpio_hold_dis` will disable this function.
  352. *
  353. * @param gpio_num GPIO number, only support output-capable GPIOs
  354. *
  355. * @return
  356. * - ESP_OK Success
  357. * - ESP_ERR_NOT_SUPPORTED Not support pad hold function
  358. */
  359. esp_err_t gpio_hold_en(gpio_num_t gpio_num);
  360. /**
  361. * @brief Disable gpio pad hold function.
  362. *
  363. * When the chip is woken up from Deep-sleep, the gpio will be set to the default mode, so, the gpio will output
  364. * the default level if this function is called. If you don't want the level changes, the gpio should be configured to
  365. * a known state before this function is called.
  366. * e.g.
  367. * If you hold gpio18 high during Deep-sleep, after the chip is woken up and `gpio_hold_dis` is called,
  368. * gpio18 will output low level(because gpio18 is input mode by default). If you don't want this behavior,
  369. * you should configure gpio18 as output mode and set it to hight level before calling `gpio_hold_dis`.
  370. *
  371. * @param gpio_num GPIO number, only support output-capable GPIOs
  372. *
  373. * @return
  374. * - ESP_OK Success
  375. * - ESP_ERR_NOT_SUPPORTED Not support pad hold function
  376. */
  377. esp_err_t gpio_hold_dis(gpio_num_t gpio_num);
  378. #if !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP
  379. /**
  380. * @brief Enable all digital gpio pads hold function during Deep-sleep.
  381. *
  382. * Enabling this feature makes all digital gpio pads be at the holding state during Deep-sleep. The state of each pad
  383. * holds is its active configuration (not pad's sleep configuration!).
  384. *
  385. * Note that this pad hold feature only works when the chip is in Deep-sleep mode. When the chip is in active mode,
  386. * the digital gpio state can be changed freely even you have called this function.
  387. *
  388. * After this API is being called, the digital gpio Deep-sleep hold feature will work during every sleep process. You
  389. * should call `gpio_deep_sleep_hold_dis` to disable this feature.
  390. */
  391. void gpio_deep_sleep_hold_en(void);
  392. /**
  393. * @brief Disable all digital gpio pads hold function during Deep-sleep.
  394. */
  395. void gpio_deep_sleep_hold_dis(void);
  396. #endif //!SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP
  397. /**
  398. * @brief Set pad input to a peripheral signal through the IOMUX.
  399. * @param gpio_num GPIO number of the pad.
  400. * @param signal_idx Peripheral signal id to input. One of the ``*_IN_IDX`` signals in ``soc/gpio_sig_map.h``.
  401. */
  402. void gpio_iomux_in(uint32_t gpio_num, uint32_t signal_idx);
  403. /**
  404. * @brief Set peripheral output to an GPIO pad through the IOMUX.
  405. * @param gpio_num gpio_num GPIO number of the pad.
  406. * @param func The function number of the peripheral pin to output pin.
  407. * One of the ``FUNC_X_*`` of specified pin (X) in ``soc/io_mux_reg.h``.
  408. * @param oen_inv True if the output enable needs to be inverted, otherwise False.
  409. */
  410. void gpio_iomux_out(uint8_t gpio_num, int func, bool oen_inv);
  411. #if SOC_GPIO_SUPPORT_FORCE_HOLD
  412. /**
  413. * @brief Force hold all digital and rtc gpio pads.
  414. *
  415. * GPIO force hold, no matter the chip in active mode or sleep modes.
  416. *
  417. * This function will immediately cause all pads to latch the current values of input enable, output enable,
  418. * output value, function, and drive strength values.
  419. *
  420. * @warning This function will hold flash and UART pins as well. Therefore, this function, and all code run afterwards
  421. * (till calling `gpio_force_unhold_all` to disable this feature), MUST be placed in internal RAM as holding the flash
  422. * pins will halt SPI flash operation, and holding the UART pins will halt any UART logging.
  423. * */
  424. esp_err_t gpio_force_hold_all(void);
  425. /**
  426. * @brief Force unhold all digital and rtc gpio pads.
  427. * */
  428. esp_err_t gpio_force_unhold_all(void);
  429. #endif
  430. /**
  431. * @brief Enable SLP_SEL to change GPIO status automantically in lightsleep.
  432. * @param gpio_num GPIO number of the pad.
  433. *
  434. * @return
  435. * - ESP_OK Success
  436. *
  437. */
  438. esp_err_t gpio_sleep_sel_en(gpio_num_t gpio_num);
  439. /**
  440. * @brief Disable SLP_SEL to change GPIO status automantically in lightsleep.
  441. * @param gpio_num GPIO number of the pad.
  442. *
  443. * @return
  444. * - ESP_OK Success
  445. */
  446. esp_err_t gpio_sleep_sel_dis(gpio_num_t gpio_num);
  447. /**
  448. * @brief GPIO set direction at sleep
  449. *
  450. * Configure GPIO direction,such as output_only,input_only,output_and_input
  451. *
  452. * @param gpio_num Configure GPIO pins number, it should be GPIO number. If you want to set direction of e.g. GPIO16, gpio_num should be GPIO_NUM_16 (16);
  453. * @param mode GPIO direction
  454. *
  455. * @return
  456. * - ESP_OK Success
  457. * - ESP_ERR_INVALID_ARG GPIO error
  458. */
  459. esp_err_t gpio_sleep_set_direction(gpio_num_t gpio_num, gpio_mode_t mode);
  460. /**
  461. * @brief Configure GPIO pull-up/pull-down resistors at sleep
  462. *
  463. * @note ESP32: Only pins that support both input & output have integrated pull-up and pull-down resistors. Input-only GPIOs 34-39 do not.
  464. *
  465. * @param gpio_num GPIO number. If you want to set pull up or down mode for e.g. GPIO16, gpio_num should be GPIO_NUM_16 (16);
  466. * @param pull GPIO pull up/down mode.
  467. *
  468. * @return
  469. * - ESP_OK Success
  470. * - ESP_ERR_INVALID_ARG : Parameter error
  471. */
  472. esp_err_t gpio_sleep_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull);
  473. #if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
  474. #define GPIO_IS_DEEP_SLEEP_WAKEUP_VALID_GPIO(gpio_num) ((gpio_num >= 0) && \
  475. (((1ULL << (gpio_num)) & SOC_GPIO_DEEP_SLEEP_WAKE_VALID_GPIO_MASK) != 0))
  476. /**
  477. * @brief Enable GPIO deep-sleep wake-up function.
  478. *
  479. * @param gpio_num GPIO number.
  480. *
  481. * @param intr_type GPIO wake-up type. Only GPIO_INTR_LOW_LEVEL or GPIO_INTR_HIGH_LEVEL can be used.
  482. *
  483. * @note Called by the SDK. User shouldn't call this directly in the APP.
  484. *
  485. * @return
  486. * - ESP_OK Success
  487. * - ESP_ERR_INVALID_ARG Parameter error
  488. */
  489. esp_err_t gpio_deep_sleep_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type);
  490. /**
  491. * @brief Disable GPIO deep-sleep wake-up function.
  492. *
  493. * @param gpio_num GPIO number
  494. *
  495. * @return
  496. * - ESP_OK Success
  497. * - ESP_ERR_INVALID_ARG Parameter error
  498. */
  499. esp_err_t gpio_deep_sleep_wakeup_disable(gpio_num_t gpio_num);
  500. #endif //SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
  501. /**
  502. * @brief Dump IO configuration information to console
  503. *
  504. * @param out_stream IO stream (e.g. stdout)
  505. * @param io_bit_mask IO pin bit mask, each bit maps to an IO
  506. *
  507. * @return
  508. * - ESP_OK Success
  509. * - ESP_ERR_INVALID_ARG Parameter error
  510. */
  511. esp_err_t gpio_dump_io_configuration(FILE *out_stream, uint64_t io_bit_mask);
  512. #ifdef __cplusplus
  513. }
  514. #endif