I have 2 GPIO pins used to wake up my ESP32C3.
GPIO 2: wake up device when active HIGH.
GPIO 3: wake up device when active LOW.
when I use the following code to and set ESP32C3 to sleep, I can wake up via both source properly.
but after the 1st wake up, I would like to disable the GPIO 2 wake up source. I tried various ways, like
esp_deep_sleep_enable_gpio_wakeup(0, ESP_GPIO_WAKEUP_GPIO_HIGH);
or
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);
both can not disable the previously enabled GPIO 2 wake up source. until ESP is rebooted.
Code: Select all
//Define bitmasks for GPIO pins used to wake from deep sleep
//Wake from deep sleep when these pins are high
const uint64_t WAKEUP_HIGH_PIN_BITMASK = 0b000100; //GPIO2 for ACC INT
//Wake from deep sleep when these pins are low,
const uint64_t WAKEUP_LOW_PIN_BITMASK = 0b001000; //GPIO3 for Button
Code: Select all
esp_deep_sleep_enable_gpio_wakeup(WAKEUP_HIGH_PIN_BITMASK, ESP_GPIO_WAKEUP_GPIO_HIGH);
esp_deep_sleep_enable_gpio_wakeup(WAKEUP_LOW_PIN_BITMASK, ESP_GPIO_WAKEUP_GPIO_LOW);
esp_deep_sleep_start();
used the following to disable the GPIO 2 wake up source. but the device still wakes up on GPIO 2 source unless ESP is rebooted.
Code: Select all
esp_deep_sleep_enable_gpio_wakeup(0, ESP_GPIO_WAKEUP_GPIO_HIGH);
Code: Select all
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);
Code: Select all
esp_deep_sleep_enable_gpio_wakeup(WAKEUP_LOW_PIN_BITMASK, ESP_GPIO_WAKEUP_GPIO_LOW);
esp_deep_sleep_start();