feat(esp_driver_gpio): support rtc_io edge wakeup deepsleep

This commit is contained in:
wuzhenghui
2026-05-20 11:04:00 +08:00
parent c67d98fb10
commit b7ec505923
12 changed files with 132 additions and 26 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -335,6 +335,16 @@ static inline void rtcio_ll_wakeup_disable(int rtcio_num)
LP_GPIO.pinn[rtcio_num].pinn_int_type = 0;
}
/**
* Clear edge-wakeup latch.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
*/
static inline void rtcio_ll_clear_edge_wakeup_latch(int rtcio_num)
{
LP_GPIO.pinn[rtcio_num].pinn_edge_wakeup_clr = 1;
}
/**
* Enable interrupt function and set interrupt type
*
@@ -341,6 +341,16 @@ static inline void rtcio_ll_wakeup_disable(int rtcio_num)
LP_IO.pin[rtcio_num].int_type = 0;
}
/**
* Clear edge-wakeup latch.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
*/
static inline void rtcio_ll_clear_edge_wakeup_latch(int rtcio_num)
{
LP_IO.pin[rtcio_num].edge_wakeup_clr = 1;
}
/**
* Enable interrupt function and set interrupt type
*
@@ -334,6 +334,16 @@ static inline void rtcio_ll_wakeup_disable(int rtcio_num)
LP_GPIO.pinn[rtcio_num].pinn_int_type = 0;
}
/**
* Clear edge-wakeup latch.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
*/
static inline void rtcio_ll_clear_edge_wakeup_latch(int rtcio_num)
{
LP_GPIO.pinn[rtcio_num].pinn_edge_wakeup_clr = 1;
}
/**
* @brief Enable interrupt function and set interrupt type
*
@@ -334,6 +334,16 @@ static inline void rtcio_ll_wakeup_disable(int rtcio_num)
LP_GPIO.pinn[rtcio_num].pinn_int_type = 0;
}
/**
* Clear edge-wakeup latch.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
*/
static inline void rtcio_ll_clear_edge_wakeup_latch(int rtcio_num)
{
LP_GPIO.pinn[rtcio_num].pinn_edge_wakeup_clr = 1;
}
/**
* @brief Enable interrupt function and set interrupt type
*
@@ -404,6 +404,16 @@ static inline void rtcio_ll_wakeup_disable(int rtcio_num)
LP_GPIO.pin[rtcio_num].int_type = 0;
}
/**
* Clear edge-wakeup latch.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
*/
static inline void rtcio_ll_clear_edge_wakeup_latch(int rtcio_num)
{
LP_GPIO.pin[rtcio_num].edge_wakeup_clr = 1;
}
/**
* Enable interrupt function and set interrupt type
*
@@ -333,6 +333,16 @@ static inline void rtcio_ll_wakeup_disable(int rtcio_num)
LP_GPIO.pinn[rtcio_num].pinn_int_type = 0;
}
/**
* Clear edge-wakeup latch.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
*/
static inline void rtcio_ll_clear_edge_wakeup_latch(int rtcio_num)
{
LP_GPIO.pinn[rtcio_num].pinn_edge_wakeup_clr = 1;
}
/**
* @brief Enable interrupt function and set interrupt type
*
@@ -320,6 +320,20 @@ void rtcio_hal_isolate(int rtcio_num);
#define rtc_hal_gpio_get_wakeup_status() rtcio_hal_get_interrupt_status()
#define rtc_hal_gpio_clear_wakeup_status() rtcio_hal_clear_interrupt_status()
#if SOC_RTC_GPIO_EDGE_WAKEUP_SUPPORTED
/**
* @brief Clear the latched edge-wakeup state for a GPIO that is enabled for
* peripheral-powerdown-sleep wakeup in edge mode.
*
* Must be called before entering sleep on every pin configured for posedge/negedge/anyedge
* wakeup, otherwise a stale latched edge would immediately wake the chip.
*
* @param hal Context of the HAL layer (unused, kept for API symmetry).
* @param gpio_num GPIO number.
*/
#define gpio_hal_clear_hp_periph_pd_sleep_edge_wakeup_latch(hal, gpio_num) rtcio_ll_clear_edge_wakeup_latch(rtc_io_num_map[gpio_num])
#endif //SOC_RTC_GPIO_EDGE_WAKEUP_SUPPORTED
/**
* @brief Get the status of whether an IO is used for sleep wake-up.
*