From f8e45766b573cc3d13c792aeca901997c5bb875a Mon Sep 17 00:00:00 2001 From: "Michael (XIAO Xufeng)" Date: Fri, 31 Dec 2021 08:09:43 +0000 Subject: [PATCH] sleep: fixed ext1 cannot wakeup via RTCIO >= 18 issue --- components/esp_system/sleep_modes.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/esp_system/sleep_modes.c b/components/esp_system/sleep_modes.c index d39dc0d03a..3b3b65ecc1 100644 --- a/components/esp_system/sleep_modes.c +++ b/components/esp_system/sleep_modes.c @@ -138,7 +138,7 @@ typedef struct { uint64_t sleep_duration; uint32_t wakeup_triggers : 15; uint32_t ext1_trigger_mode : 1; - uint32_t ext1_rtc_gpio_mask : 18; + uint32_t ext1_rtc_gpio_mask : 22; //22 is the maximum RTCIO number in all chips uint32_t ext0_trigger_level : 1; uint32_t ext0_rtc_gpio_num : 5; uint32_t gpio_wakeup_mask : 6; @@ -153,6 +153,8 @@ typedef struct { #endif } sleep_config_t; +_Static_assert(22 >= SOC_RTCIO_PIN_COUNT, "Chip has more RTCIOs than 22, should increase ext1_rtc_gpio_mask field size"); + static sleep_config_t s_config = { .pd_options = { ESP_PD_OPTION_AUTO, ESP_PD_OPTION_AUTO, ESP_PD_OPTION_AUTO, ESP_PD_OPTION_AUTO,