Chapter 2. API Reference
Parameters
• gpio_num: GPIO number
• isr_handler: ISR handler function for the corresponding GPIO number.
• args: parameter for ISR handler.
esp_err_t gpio_isr_handler_remove(gpio_num_t gpio_num)
Remove ISR handler for the corresponding GPIO pin.
Return
• ESP_OK Success
• ESP_ERR_INVALID_STATE Wrong state, the ISR service has not been initialized.
• ESP_ERR_INVALID_ARG Parameter error
Parameters
• gpio_num: GPIO number
esp_err_t gpio_set_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t strength)
Set GPIO pad drive capability.
Return
• ESP_OK Success
• ESP_ERR_INVALID_ARG Parameter error
Parameters
• gpio_num: GPIO number, only support output GPIOs
• strength: Drive capability of the pad
esp_err_t gpio_get_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t *strength)
Get GPIO pad drive capability.
Return
• ESP_OK Success
• ESP_ERR_INVALID_ARG Parameter error
Parameters
• gpio_num: GPIO number, only support output GPIOs
• strength: Pointer to accept drive capability of the pad
esp_err_t gpio_hold_en(gpio_num_t gpio_num)
Enable gpio pad hold function.
The gpio pad hold function works in both input and output modes, but must be output-capable gpios. If pad
hold enabled: in output mode: the output level of the pad will be force locked and can not be changed. in input
mode: the input value read will not change, regardless the changes of input signal.
The state of digital gpio cannot be held during Deep-sleep, and it will resume the hold function when
the chip wakes up from Deep-sleep. If the digital gpio also needs to be held during Deep-sleep,
gpio_deep_sleep_hold_en should also be called.
Power down or call gpio_hold_dis will disable this function.
Return
• ESP_OK Success
• ESP_ERR_NOT_SUPPORTED Not support pad hold function
Parameters
• gpio_num: GPIO number, only support output-capable GPIOs
esp_err_t gpio_hold_dis(gpio_num_t gpio_num)
Disable gpio pad hold function.
When the chip is woken up from Deep-sleep, the gpio will be set to the default mode, so, the gpio will output
the default level if this function is called. If you don’t want the level changes, the gpio should be configured
to a known state before this function is called. e.g. If you hold gpio18 high during Deep-sleep, after the chip
is woken up and gpio_hold_dis is called, gpio18 will output low level(because gpio18 is input mode by
default). If you don’t want this behavior, you should configure gpio18 as output mode and set it to hight level
before calling gpio_hold_dis.
Return
Espressif Systems 254
Submit Document Feedback
Release v4.4