Chapter 2. API Reference
esp_err_t
esp_sleep_enable_ext1_wakeup(uint64_t mask,
Enable wakeup using multiple pins.
This function uses external wakeup feature of RTC controller. It will work even if RTC peripherals are shut
down during sleep.
This feature can monitor any number of pins which are in RTC IOs. Once any of the selected pins goes into
the state given by mode argument, the chip will be woken up.
Note This function does not modify pin configuration. The pins are configured in esp_sleep_start, immediately
before entering sleep mode.
Note internal pullups and pulldowns don't work when RTC peripherals are shut down. In this case, external
resistors need to be added. Alternatively, RTC peripherals (and pullups/pulldowns) may be kept enabled
using esp_sleep_pd_config function.
Return
• ESP_OK on success
• ESP_ERR_INVALID_ARG if any of the selected GPIOs is not an RTC GPIO, or mode is invalid
Parameters
• mask: bit mask of GPIO numbers which will cause wakeup. Only GPIOs which are have RTC
functionality can be used in this bit map: 0,2,4,12-15,25-27,32-39.
• mode: select logic function used to determine wakeup condition:
– ESP_EXT1_WAKEUP_ALL_LOW: wake up when all selected GPIOs are low
– ESP_EXT1_WAKEUP_ANY_HIGH: wake up when any of the selected GPIOs is high
esp_err_t
esp_sleep_enable_gpio_wakeup(void)
Enable wakeup from light sleep using GPIOs.
Each GPIO supports wakeup function, which can be triggered on either low level or high level. Unlike EXT0
and EXT1 wakeup sources, this method can be used both for all IOs: RTC IOs and digital IOs. It can only be
used to wakeup from light sleep though.
To enable wakeup, first call gpio_wakeup_enable, specifying gpio number and wakeup level, for each GPIO
which is used for wakeup. Then call this function to enable wakeup feature.
Note In revisions 0 and 1 of the ESP32, GPIO wakeup source can not be used together with touch or ULP
wakeup sources.
Return
• ESP_OK on success
• ESP_ERR_INVALID_STATE if wakeup triggers conflict
esp_err_t
esp_sleep_enable_uart_wakeup(int uart_num)
Enable wakeup from light sleep using UART.
Use uart_set_wakeup_threshold function to configure UART wakeup threshold.
Wakeup from light sleep takes some time, so not every character sent to the UART can be received by the
application.
Note ESP32 does not support wakeup from UART2.
Return
• ESP_OK on success
• ESP_ERR_INVALID_ARG if wakeup from given UART is not supported
Parameters
• uart_num: UART port to wake up from
esp_err_t
esp_sleep_enable_wifi_wakeup(void)
Enable wakeup by WiFi MAC.
Return
• ESP_OK on success
esp_err_t
esp_sleep_disable_wifi_wakeup(void)
Disable wakeup by WiFi MAC.
Return
• ESP_OK on success
Espressif Systems
1043
Submit Document Feedback
esp_sleep_ext1_wakeup_mode_t
mode)
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers