fix(rtc_timer): disable target before setting wakeup time to avoid intermediate states

This commit is contained in:
wuzhenghui
2026-07-22 12:55:52 +08:00
parent 10f8b195b0
commit 412bce6544
16 changed files with 180 additions and 14 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -31,6 +31,18 @@ FORCE_INLINE_ATTR void rtc_timer_ll_set_wakeup_time(uint8_t timer_id, uint64_t t
SET_PERI_REG_MASK(RTC_CNTL_SLP_TIMER1_REG, RTC_CNTL_MAIN_TIMER_ALARM_EN_M);
}
/**
* @brief Clear/disarm the wakeup timer alarm enabled by rtc_timer_ll_set_wakeup_time()
*
* @param timer_id Timer ID (ignored for V1 hardware, only one timer supported)
*/
FORCE_INLINE_ATTR void rtc_timer_ll_clear_wakeup_time(uint8_t timer_id)
{
(void)timer_id; // V1 hardware only supports one timer
CLEAR_PERI_REG_MASK(RTC_CNTL_SLP_TIMER1_REG, RTC_CNTL_MAIN_TIMER_ALARM_EN_M);
SET_PERI_REG_MASK(RTC_CNTL_INT_CLR_REG, RTC_CNTL_MAIN_TIMER_INT_CLR_M);
}
/**
* @brief Get current RTC timer cycle count
*