esp32: Deactivate wakeup trigger after first wakeup

Added function esp_sleep_disable_wakeup_source() to deactivate wakeup trigger for selected source.
Updated documentation for this function in sleep_modes.rst file.
Updated unit test to check this functionality for light sleep.
The test_sleep.c unit test is updated to add reliability for unit testing.

(TW#18952)
Closes https://github.com/espressif/esp-idf/issues/1677
This commit is contained in:
Alex Lisitsyn
2018-03-16 11:57:35 +05:00
parent 2d90da0817
commit ce09cfd99b
5 changed files with 189 additions and 82 deletions

View File

@@ -10,7 +10,7 @@ In light sleep mode, digital peripherals, most of the RAM, and CPUs are clock-ga
In deep sleep mode, CPUs, most of the RAM, and all the digital peripherals which are clocked from APB_CLK are powered off. The only parts of the chip which can still be powered on are: RTC controller, RTC peripherals (including ULP coprocessor), and RTC memories (slow and fast).
Wakeup from deep and light sleep modes can be done using several sources. These sources can be combined, in this case the chip will wake up when any one of the sources is triggered. Wakeup sources can be enabled using ``esp_sleep_enable_X_wakeup`` APIs. Next section describes these APIs in detail. Wakeup sources can be configured at any moment before entering light or deep sleep mode.
Wakeup from deep and light sleep modes can be done using several sources. These sources can be combined, in this case the chip will wake up when any one of the sources is triggered. Wakeup sources can be enabled using ``esp_sleep_enable_X_wakeup`` APIs and can be disabled using ``esp_sleep_disable_wakeup_source`` API. Next section describes these APIs in detail. Wakeup sources can be configured at any moment before entering light or deep sleep mode.
Additionally, the application can force specific powerdown modes for the RTC peripherals and RTC memories using ``esp_sleep_pd_config`` API.
@@ -37,10 +37,6 @@ The following function can be used to enable deep sleep wakeup using a timer.
.. doxygenfunction:: esp_sleep_enable_timer_wakeup
The timer wakeup functionality can be disabled to use other wakeup sources instead of timer after first sleep. The function below can be used in this case.
.. doxygenfunction:: esp_sleep_disable_timer_wakeup
Touch pad
^^^^^^^^^
@@ -150,6 +146,13 @@ The following function can be used to check which wakeup source has triggered wa
.. doxygenfunction:: esp_sleep_get_touchpad_wakeup_status
.. doxygenfunction:: esp_sleep_get_ext1_wakeup_status
Disable sleep wakeup source
---------------------------
Previously configured wakeup source can be disabled later using ``esp_sleep_disable_wakeup_source`` API. This function deactivates trigger for source defined as input parameter if it should not be used to wake up from sleep.
.. doxygenenum:: esp_sleep_source_t
.. doxygenfunction:: esp_sleep_disable_wakeup_source
Application Example
-------------------