deep_sleep

An ESP-IDF component for Physical Computing

Purpose

Deep Sleep functionality for ESP32 systems.

Wakeup sources can be:

  • one gpio pin
  • timer

How it is done

A simple Deep Sleep functionality is implemented through class DeepSleep.

If wakeup from Deep Sleep shall be triggered by a timer the method EnableTimerWakeup has to be called.

If wakeup from Deep Sleep shall be triggered by pushing a button the method EnableGpioWakeup has to be called.

To go to Deep Sleep the method GoToDeepSleep has to be called.

Where to find it

deep_sleep is published on the ESP Registry at https://components.espressif.com/components/elrebo-de/deep_sleep.

The source code can be found at https://github.com/elrebo-de/deep_sleep.

How to use it

As an ESP-IDF component deep_sleep must be included into idf_component.yml as a dependency. As usual this can be done by executing this command:

idf.py add-dependency "elrebo-de/deep_sleep^1.1.1"

In CMakeLists.txt "elrebo-de__deep_sleep" has to be added as a requirement.

Now you can include deep_sleep.hpp and use the DeepSleep class in your program.

The constructor of class DeepSleep needs a pointer to an RTC_DATA_ATTR int bootCount. This bootCount variable is incremented for every boot.

There are two parameters in the constructor of class Wifi:

  • tag – the tag used for logging from this instance of Wifi class
  • bootCount – a pointer to an RTC_DATA_ATTR int which counts the number of boots

Comments

One response to “deep_sleep”

  1. […] elrebo-de/deep_sleep – to go to deep sleep […]

Leave a Reply to Physical Computing – elrebo Cancel reply

Your email address will not be published. Required fields are marked *