Chapter 2. API Reference
• ESP_OK Success
• ESP_ERR_NOT_SUPPORTED Not support pad hold function
Parameters
• gpio_num: GPIO number, only support output-capable GPIOs
void gpio_deep_sleep_hold_en(void)
Enable all digital gpio pad hold function during Deep-sleep.
When the chip is in Deep-sleep mode, all digital gpio will hold the state before sleep, and when the chip is
woken up, the status of digital gpio will not be held. Note that the pad hold feature only works when the chip
is in Deep-sleep mode, when not in sleep mode, the digital gpio state can be changed even you have called this
function.
Power down or call gpio_hold_dis will disable this function, otherwise, the digital gpio hold feature works as
long as the chip enter Deep-sleep.
void gpio_deep_sleep_hold_dis(void)
Disable all digital gpio pad hold function during Deep-sleep.
void gpio_iomux_in(uint32_t gpio_num, uint32_t signal_idx)
Set pad input to a peripheral signal through the IOMUX.
Parameters
• gpio_num: GPIO number of the pad.
• signal_idx: Peripheral signal id to input. One of the *_IN_IDX signals in soc/
gpio_sig_map.h.
void gpio_iomux_out(uint8_t gpio_num, int func, bool oen_inv)
Set peripheral output to an GPIO pad through the IOMUX.
Parameters
• gpio_num: gpio_num GPIO number of the pad.
• func: The function number of the peripheral pin to output pin. One of the FUNC_X_* of specified
pin (X) in soc/io_mux_reg.h.
• oen_inv: True if the output enable needs to be inverted, otherwise False.
esp_err_t gpio_force_hold_all(void)
Force hold digital and rtc gpio pad.
Note GPIO force hold, whether the chip in sleep mode or wakeup mode.
esp_err_t gpio_force_unhold_all(void)
Force unhold digital and rtc gpio pad.
Note GPIO force unhold, whether the chip in sleep mode or wakeup mode.
esp_err_t gpio_sleep_sel_en(gpio_num_t gpio_num)
Enable SLP_SEL to change GPIO status automantically in lightsleep.
Return
• ESP_OK Success
Parameters
• gpio_num: GPIO number of the pad.
esp_err_t gpio_sleep_sel_dis(gpio_num_t gpio_num)
Disable SLP_SEL to change GPIO status automantically in lightsleep.
Return
• ESP_OK Success
Parameters
• gpio_num: GPIO number of the pad.
esp_err_t gpio_sleep_set_direction(gpio_num_t gpio_num, gpio_mode_t mode)
GPIO set direction at sleep.
Configure GPIO direction,such as output_only,input_only,output_and_input
Return
Espressif Systems 255
Submit Document Feedback
Release v4.4