esp32: Deactivate wakeup trigger after first wakeup

The timer wakeup function once activated cannot be disabled later using existing api. If user wants to use different wakeup sources after first sleep but it does not work. This change disables timer wakeup trigger in configuration that will be set into appropriate RTC registers in esp_light_sleep_start() function.

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

(TW#18952)
Closes https://github.com/espressif/esp-idf/issues/1677
This commit is contained in:
Alex Lisitsyn
2018-03-14 10:54:45 +05:00
parent 77eae33a7e
commit 2d90da0817
5 changed files with 86 additions and 4 deletions

View File

@@ -75,7 +75,7 @@ typedef enum {
*/
esp_err_t esp_sleep_enable_ulp_wakeup();
/**
/**
* @brief Enable wakeup by timer
* @param time_in_us time before wakeup, in microseconds
* @return
@@ -84,6 +84,23 @@ esp_err_t esp_sleep_enable_ulp_wakeup();
*/
esp_err_t esp_sleep_enable_timer_wakeup(uint64_t time_in_us);
/**
* @brief Disable timer wakeup
*
* This function is used to deactivate timer wakeup trigger
* after first sleep for example to allow wakeup from other sources.
*
* @note This function does not modify wakeup configuration in RTC.
* It will be performed in esp_sleep_start function.
*
* See docs/sleep-modes.rst for details.
*
* @return
* - ESP_OK on success
* - ESP_ERR_INVALID_STATE if trigger was not active
*/
esp_err_t esp_sleep_disable_timer_wakeup();
/**
* @brief Enable wakeup by touch sensor
*