mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-14 14:06:54 +00:00
esp_timer: Timers with skip_unhandled_events option won't wake up system from light sleep
This commit is contained in:

committed by
bot

parent
cdad1eaa9c
commit
f9ad16bb66
@@ -598,3 +598,26 @@ int64_t IRAM_ATTR esp_timer_get_next_alarm(void)
|
||||
}
|
||||
return next_alarm;
|
||||
}
|
||||
|
||||
int64_t IRAM_ATTR esp_timer_get_next_alarm_for_wake_up(void)
|
||||
{
|
||||
int64_t next_alarm = INT64_MAX;
|
||||
for (esp_timer_dispatch_t dispatch_method = ESP_TIMER_TASK; dispatch_method < ESP_TIMER_MAX; ++dispatch_method) {
|
||||
timer_list_lock(dispatch_method);
|
||||
esp_timer_handle_t it;
|
||||
LIST_FOREACH(it, &s_timers[dispatch_method], list_entry) {
|
||||
if (it == NULL) {
|
||||
break;
|
||||
}
|
||||
// timers with the SKIP_UNHANDLED_EVENTS flag do not want to wake up CPU from a sleep mode.
|
||||
if ((it->flags & FL_SKIP_UNHANDLED_EVENTS) == 0) {
|
||||
if (next_alarm > it->alarm) {
|
||||
next_alarm = it->alarm;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
timer_list_unlock(dispatch_method);
|
||||
}
|
||||
return next_alarm;
|
||||
}
|
||||
|
Reference in New Issue
Block a user