Api Hal OS/Power: split insomnia and return to where it belongs. (#393)

This commit is contained in:
あく
2021-03-31 20:55:00 +03:00
committed by GitHub
parent 5439e232cc
commit 81ace53cc1
4 changed files with 50 additions and 16 deletions

View File

@@ -99,6 +99,11 @@ static inline uint32_t api_hal_os_sleep(TickType_t expected_idle_ticks) {
}
void vPortSuppressTicksAndSleep(TickType_t expected_idle_ticks) {
if(!api_hal_power_sleep_available()) {
__WFI();
return;
}
// Limit mount of ticks to maximum that timer can count
if (expected_idle_ticks > API_HAL_OS_MAX_SLEEP) {
expected_idle_ticks = API_HAL_OS_MAX_SLEEP;