mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(esp_pm): configure timer wakeup source with auto light-sleep congiguration
This commit is contained in:
parent
3883a17f54
commit
b752b6c5e9
@ -455,6 +455,16 @@ esp_err_t esp_pm_configure(const void* vconfig)
|
|||||||
res = rtc_clk_cpu_freq_mhz_to_config(min_freq_mhz, &s_cpu_freq_by_mode[PM_MODE_APB_MIN]);
|
res = rtc_clk_cpu_freq_mhz_to_config(min_freq_mhz, &s_cpu_freq_by_mode[PM_MODE_APB_MIN]);
|
||||||
assert(res);
|
assert(res);
|
||||||
s_cpu_freq_by_mode[PM_MODE_LIGHT_SLEEP] = s_cpu_freq_by_mode[PM_MODE_APB_MIN];
|
s_cpu_freq_by_mode[PM_MODE_LIGHT_SLEEP] = s_cpu_freq_by_mode[PM_MODE_APB_MIN];
|
||||||
|
|
||||||
|
if (config->light_sleep_enable) {
|
||||||
|
// Enable the wakeup source here because the `esp_sleep_disable_wakeup_source` in the `else`
|
||||||
|
// branch must be called if corresponding wakeup source is already enabled.
|
||||||
|
esp_sleep_enable_timer_wakeup(0);
|
||||||
|
} else if (s_light_sleep_en) {
|
||||||
|
// Since auto light-sleep will enable the timer wakeup source, to avoid affecting subsequent possible
|
||||||
|
// deepsleep requests, disable the timer wakeup source here.
|
||||||
|
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER);
|
||||||
|
}
|
||||||
s_light_sleep_en = config->light_sleep_enable;
|
s_light_sleep_en = config->light_sleep_enable;
|
||||||
s_config_changed = true;
|
s_config_changed = true;
|
||||||
portEXIT_CRITICAL(&s_switch_lock);
|
portEXIT_CRITICAL(&s_switch_lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user