examples: Update deep sleep example for ESP32-C3

This commit is contained in:
Angus Gratton 2021-01-16 16:53:43 +11:00 committed by bot
parent 0eb8d7e185
commit 1cfd65f8c4
2 changed files with 14 additions and 3 deletions

View File

@ -3,6 +3,7 @@ menu "Example Configuration"
config EXAMPLE_TOUCH_WAKEUP config EXAMPLE_TOUCH_WAKEUP
bool "Enable touch wake up" bool "Enable touch wake up"
default y default y
depends on !IDF_TARGET_ESP32C3
help help
This option enables wake up from deep sleep using touch pads This option enables wake up from deep sleep using touch pads
TOUCH8 and TOUCH9, which correspond to GPIO33 and GPIO32. TOUCH8 and TOUCH9, which correspond to GPIO33 and GPIO32.
@ -10,6 +11,7 @@ menu "Example Configuration"
config EXAMPLE_ULP_TEMPERATURE_WAKEUP config EXAMPLE_ULP_TEMPERATURE_WAKEUP
bool "Enable temperature monitoring by ULP" bool "Enable temperature monitoring by ULP"
default y default y
depends on IDF_TARGET_ESP32
help help
This option enables wake up from deep sleep using ULP. This option enables wake up from deep sleep using ULP.
ULP program monitors the on-chip temperature sensor and ULP program monitors the on-chip temperature sensor and
@ -20,6 +22,7 @@ menu "Example Configuration"
config EXAMPLE_EXT1_WAKEUP config EXAMPLE_EXT1_WAKEUP
bool "Enable wakeup from GPIO" bool "Enable wakeup from GPIO"
default y default y
depends on !IDF_TARGET_ESP32C3
help help
This option enables wake up from deep sleep from GPIO2 and GPIO4. They should be connected to LOW to avoid This option enables wake up from deep sleep from GPIO2 and GPIO4. They should be connected to LOW to avoid
floating pins. When triggering a wake up, connect one or both of the pins to HIGH. Note that floating floating pins. When triggering a wake up, connect one or both of the pins to HIGH. Note that floating

View File

@ -12,17 +12,25 @@
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include "sdkconfig.h"
#include "soc/soc_caps.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "esp_sleep.h" #include "esp_sleep.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp32/ulp.h"
#include "driver/touch_pad.h"
#include "driver/adc.h" #include "driver/adc.h"
#include "driver/rtc_io.h" #include "driver/rtc_io.h"
#include "soc/sens_periph.h"
#include "soc/rtc.h" #include "soc/rtc.h"
#if CONFIG_IDF_TARGET_ESP32
#include "esp32/ulp.h"
#endif
#if SOC_TOUCH_SENSOR_NUM > 0
#include "soc/sens_periph.h"
#include "driver/touch_pad.h"
#endif
static RTC_DATA_ATTR struct timeval sleep_enter_time; static RTC_DATA_ATTR struct timeval sleep_enter_time;
#ifdef CONFIG_EXAMPLE_ULP_TEMPERATURE_WAKEUP #ifdef CONFIG_EXAMPLE_ULP_TEMPERATURE_WAKEUP