mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
use LL function to get wakeup cause
This commit is contained in:
committed by
wuzhenghui
parent
4261fd0940
commit
72676d230a
@ -1289,11 +1289,7 @@ esp_sleep_wakeup_cause_t esp_sleep_get_wakeup_cause(void)
|
|||||||
return ESP_SLEEP_WAKEUP_UNDEFINED;
|
return ESP_SLEEP_WAKEUP_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
uint32_t wakeup_cause = rtc_cntl_ll_get_wakeup_cause();
|
||||||
uint32_t wakeup_cause = REG_GET_FIELD(RTC_CNTL_WAKEUP_STATE_REG, RTC_CNTL_WAKEUP_CAUSE);
|
|
||||||
#else
|
|
||||||
uint32_t wakeup_cause = REG_GET_FIELD(RTC_CNTL_SLP_WAKEUP_CAUSE_REG, RTC_CNTL_WAKEUP_CAUSE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (wakeup_cause & RTC_TIMER_TRIG_EN) {
|
if (wakeup_cause & RTC_TIMER_TRIG_EN) {
|
||||||
return ESP_SLEEP_WAKEUP_TIMER;
|
return ESP_SLEEP_WAKEUP_TIMER;
|
||||||
|
@ -436,8 +436,7 @@ __attribute__((unused)) static float get_time_ms(void)
|
|||||||
|
|
||||||
__attribute__((unused)) static uint32_t get_cause(void)
|
__attribute__((unused)) static uint32_t get_cause(void)
|
||||||
{
|
{
|
||||||
uint32_t wakeup_cause = REG_GET_FIELD(RTC_CNTL_WAKEUP_STATE_REG, \
|
uint32_t wakeup_cause = rtc_cntl_ll_get_wakeup_cause();
|
||||||
RTC_CNTL_WAKEUP_CAUSE);
|
|
||||||
return wakeup_cause;
|
return wakeup_cause;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user