forked from espressif/esp-idf
change(pm/ext1): replace esp_sleep_set_ext1_wakeup_io by esp_sleep_enable_ext1_wakeup_io
This commit is contained in:
@@ -269,7 +269,7 @@ esp_err_t esp_sleep_enable_ext0_wakeup(gpio_num_t gpio_num, int level);
|
|||||||
*
|
*
|
||||||
* @note Call this func will reset the previous ext1 configuration.
|
* @note Call this func will reset the previous ext1 configuration.
|
||||||
*
|
*
|
||||||
* @note This function will be deprecated in release/v6.0. Please switch to use `esp_sleep_set_ext1_wakeup_io` and `esp_sleep_clear_ext1_wakeup_io`
|
* @note This function will be deprecated in release/v6.0. Please switch to use `esp_sleep_enable_ext1_wakeup_io` and `esp_sleep_clear_ext1_wakeup_io`
|
||||||
*
|
*
|
||||||
* @param io_mask Bit mask of GPIO numbers which will cause wakeup. Only GPIOs
|
* @param io_mask Bit mask of GPIO numbers which will cause wakeup. Only GPIOs
|
||||||
* which have RTC functionality can be used in this bit map.
|
* which have RTC functionality can be used in this bit map.
|
||||||
@@ -320,8 +320,6 @@ esp_err_t esp_sleep_enable_ext1_wakeup(uint64_t io_mask, esp_sleep_ext1_wakeup_m
|
|||||||
* the pins during sleep. HOLD feature will be acted on the pin internally
|
* the pins during sleep. HOLD feature will be acted on the pin internally
|
||||||
* before the system entering sleep, and this can further reduce power consumption.
|
* before the system entering sleep, and this can further reduce power consumption.
|
||||||
*
|
*
|
||||||
* @note this func allows to increase the configuration for ext1 without resetting the previous configuration.
|
|
||||||
*
|
|
||||||
* @param io_mask Bit mask of GPIO numbers which will cause wakeup. Only GPIOs
|
* @param io_mask Bit mask of GPIO numbers which will cause wakeup. Only GPIOs
|
||||||
* which have RTC functionality can be used in this bit map.
|
* which have RTC functionality can be used in this bit map.
|
||||||
* For different SoCs, the related GPIOs are:
|
* For different SoCs, the related GPIOs are:
|
||||||
@@ -344,7 +342,7 @@ esp_err_t esp_sleep_enable_ext1_wakeup(uint64_t io_mask, esp_sleep_ext1_wakeup_m
|
|||||||
* - ESP_ERR_NOT_ALLOWED when wakeup level will become different between
|
* - ESP_ERR_NOT_ALLOWED when wakeup level will become different between
|
||||||
* ext1 IOs if !SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN
|
* ext1 IOs if !SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN
|
||||||
*/
|
*/
|
||||||
esp_err_t esp_sleep_set_ext1_wakeup_io(uint64_t io_mask, esp_sleep_ext1_wakeup_mode_t level_mode);
|
esp_err_t esp_sleep_enable_ext1_wakeup_io(uint64_t io_mask, esp_sleep_ext1_wakeup_mode_t level_mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Disable ext1 wakeup pins with IO masks. This will remove selected IOs from the wakeup IOs.
|
* @brief Disable ext1 wakeup pins with IO masks. This will remove selected IOs from the wakeup IOs.
|
||||||
@@ -403,7 +401,7 @@ esp_err_t esp_sleep_clear_ext1_wakeup_io(uint64_t io_mask);
|
|||||||
* or mode is invalid
|
* or mode is invalid
|
||||||
*/
|
*/
|
||||||
esp_err_t esp_sleep_enable_ext1_wakeup_with_level_mask(uint64_t io_mask, uint64_t level_mask)
|
esp_err_t esp_sleep_enable_ext1_wakeup_with_level_mask(uint64_t io_mask, uint64_t level_mask)
|
||||||
__attribute__((deprecated("please use 'esp_sleep_set_ext1_wakeup_io' and 'esp_sleep_clear_ext1_wakeup_io' instead")));
|
__attribute__((deprecated("please use 'esp_sleep_enable_ext1_wakeup_io' and 'esp_sleep_clear_ext1_wakeup_io' instead")));
|
||||||
|
|
||||||
#endif // SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN
|
#endif // SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN
|
||||||
#endif // SOC_PM_SUPPORT_EXT1_WAKEUP
|
#endif // SOC_PM_SUPPORT_EXT1_WAKEUP
|
||||||
|
@@ -1494,11 +1494,11 @@ esp_err_t esp_sleep_enable_ext1_wakeup(uint64_t io_mask, esp_sleep_ext1_wakeup_m
|
|||||||
// Reset all EXT1 configs
|
// Reset all EXT1 configs
|
||||||
esp_sleep_clear_ext1_wakeup_io(0);
|
esp_sleep_clear_ext1_wakeup_io(0);
|
||||||
|
|
||||||
return esp_sleep_set_ext1_wakeup_io(io_mask, level_mode);
|
return esp_sleep_enable_ext1_wakeup_io(io_mask, level_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t esp_sleep_set_ext1_wakeup_io(uint64_t io_mask, esp_sleep_ext1_wakeup_mode_t level_mode)
|
esp_err_t esp_sleep_enable_ext1_wakeup_io(uint64_t io_mask, esp_sleep_ext1_wakeup_mode_t level_mode)
|
||||||
{
|
{
|
||||||
if (io_mask == 0 && level_mode > ESP_EXT1_WAKEUP_ANY_HIGH) {
|
if (io_mask == 0 && level_mode > ESP_EXT1_WAKEUP_ANY_HIGH) {
|
||||||
return ESP_ERR_INVALID_ARG;
|
return ESP_ERR_INVALID_ARG;
|
||||||
|
@@ -182,7 +182,7 @@ TEST_CASE("Can wake up from automatic light sleep by GPIO", "[pm][ignore]")
|
|||||||
rtc_gpio_set_level(ext1_wakeup_gpio, 0);
|
rtc_gpio_set_level(ext1_wakeup_gpio, 0);
|
||||||
|
|
||||||
/* Enable wakeup */
|
/* Enable wakeup */
|
||||||
TEST_ESP_OK(esp_sleep_set_ext1_wakeup_io(1ULL << ext1_wakeup_gpio, ESP_EXT1_WAKEUP_ANY_HIGH));
|
TEST_ESP_OK(esp_sleep_enable_ext1_wakeup_io(1ULL << ext1_wakeup_gpio, ESP_EXT1_WAKEUP_ANY_HIGH));
|
||||||
|
|
||||||
/* To simplify test environment, we'll use a ULP program to set GPIO high */
|
/* To simplify test environment, we'll use a ULP program to set GPIO high */
|
||||||
ulp_insn_t ulp_code[] = {
|
ulp_insn_t ulp_code[] = {
|
||||||
|
@@ -416,7 +416,7 @@ TEST_CASE("wake up using ext1 when RTC_PERIPH is off (13 high)", "[deepsleep][ig
|
|||||||
{
|
{
|
||||||
// This test needs external pulldown
|
// This test needs external pulldown
|
||||||
ESP_ERROR_CHECK(rtc_gpio_init(GPIO_NUM_13));
|
ESP_ERROR_CHECK(rtc_gpio_init(GPIO_NUM_13));
|
||||||
ESP_ERROR_CHECK(esp_sleep_set_ext1_wakeup_io(BIT(GPIO_NUM_13), ESP_EXT1_WAKEUP_ANY_HIGH));
|
ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(BIT(GPIO_NUM_13), ESP_EXT1_WAKEUP_ANY_HIGH));
|
||||||
esp_deep_sleep_start();
|
esp_deep_sleep_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,9 +425,9 @@ TEST_CASE("wake up using ext1 when RTC_PERIPH is off (13 low)", "[deepsleep][ign
|
|||||||
// This test needs external pullup
|
// This test needs external pullup
|
||||||
ESP_ERROR_CHECK(rtc_gpio_init(GPIO_NUM_13));
|
ESP_ERROR_CHECK(rtc_gpio_init(GPIO_NUM_13));
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
ESP_ERROR_CHECK(esp_sleep_set_ext1_wakeup_io(BIT(GPIO_NUM_13), ESP_EXT1_WAKEUP_ALL_LOW));
|
ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(BIT(GPIO_NUM_13), ESP_EXT1_WAKEUP_ALL_LOW));
|
||||||
#else
|
#else
|
||||||
ESP_ERROR_CHECK(esp_sleep_set_ext1_wakeup_io(BIT(GPIO_NUM_13), ESP_EXT1_WAKEUP_ANY_LOW));
|
ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(BIT(GPIO_NUM_13), ESP_EXT1_WAKEUP_ANY_LOW));
|
||||||
#endif
|
#endif
|
||||||
esp_deep_sleep_start();
|
esp_deep_sleep_start();
|
||||||
}
|
}
|
||||||
@@ -438,7 +438,7 @@ TEST_CASE("wake up using ext1 when RTC_PERIPH is on (13 high)", "[deepsleep][ign
|
|||||||
ESP_ERROR_CHECK(gpio_pullup_dis(GPIO_NUM_13));
|
ESP_ERROR_CHECK(gpio_pullup_dis(GPIO_NUM_13));
|
||||||
ESP_ERROR_CHECK(gpio_pulldown_en(GPIO_NUM_13));
|
ESP_ERROR_CHECK(gpio_pulldown_en(GPIO_NUM_13));
|
||||||
ESP_ERROR_CHECK(esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON));
|
ESP_ERROR_CHECK(esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON));
|
||||||
ESP_ERROR_CHECK(esp_sleep_set_ext1_wakeup_io(BIT(GPIO_NUM_13), ESP_EXT1_WAKEUP_ANY_HIGH));
|
ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(BIT(GPIO_NUM_13), ESP_EXT1_WAKEUP_ANY_HIGH));
|
||||||
esp_deep_sleep_start();
|
esp_deep_sleep_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,9 +449,9 @@ TEST_CASE("wake up using ext1 when RTC_PERIPH is on (13 low)", "[deepsleep][igno
|
|||||||
ESP_ERROR_CHECK(gpio_pulldown_dis(GPIO_NUM_13));
|
ESP_ERROR_CHECK(gpio_pulldown_dis(GPIO_NUM_13));
|
||||||
ESP_ERROR_CHECK(esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON));
|
ESP_ERROR_CHECK(esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON));
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
ESP_ERROR_CHECK(esp_sleep_set_ext1_wakeup_io(BIT(GPIO_NUM_13), ESP_EXT1_WAKEUP_ALL_LOW));
|
ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(BIT(GPIO_NUM_13), ESP_EXT1_WAKEUP_ALL_LOW));
|
||||||
#else
|
#else
|
||||||
ESP_ERROR_CHECK(esp_sleep_set_ext1_wakeup_io(BIT(GPIO_NUM_13), ESP_EXT1_WAKEUP_ANY_LOW));
|
ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(BIT(GPIO_NUM_13), ESP_EXT1_WAKEUP_ANY_LOW));
|
||||||
#endif
|
#endif
|
||||||
esp_deep_sleep_start();
|
esp_deep_sleep_start();
|
||||||
}
|
}
|
||||||
|
@@ -248,15 +248,13 @@ RTC peripherals or RTC memories do not need to be powered on during sleep in thi
|
|||||||
gpio_pullup_dis(gpio_num);
|
gpio_pullup_dis(gpio_num);
|
||||||
gpio_pulldown_en(gpio_num);
|
gpio_pulldown_en(gpio_num);
|
||||||
|
|
||||||
:cpp:func:`esp_sleep_set_ext1_wakeup_io` function can be used to append ext1 wakeup IO and set corresponding wakeup level.
|
:cpp:func:`esp_sleep_enable_ext1_wakeup_io` function can be used to append ext1 wakeup IO and set corresponding wakeup level.
|
||||||
|
|
||||||
:cpp:func:`esp_sleep_clear_ext1_wakeup_io` function can be used to remove ext1 wakeup IO.
|
:cpp:func:`esp_sleep_clear_ext1_wakeup_io` function can be used to remove ext1 wakeup IO.
|
||||||
|
|
||||||
:cpp:func:`esp_sleep_enable_ext1_wakeup` function can be used to reset all previous ext1 wakeup configurations and enable new ext1 wakeup IO and set corresponding wakeup level.
|
|
||||||
|
|
||||||
.. only:: SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN
|
.. only:: SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN
|
||||||
|
|
||||||
The RTC controller also supports triggering wakeup, allowing configurable IO to use different wakeup levels simultaneously. This can be configured with :cpp:func`esp_sleep_set_ext1_wakeup_io`.
|
The RTC controller also supports triggering wakeup, allowing configurable IO to use different wakeup levels simultaneously. This can be configured with :cpp:func`esp_sleep_enable_ext1_wakeup_io`.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
|
@@ -6,4 +6,4 @@ System
|
|||||||
Power Management
|
Power Management
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
* ``esp_sleep_enable_ext1_wakeup_with_level_mask`` is deprecated, use ``esp_sleep_set_ext1_wakeup_io`` and ``esp_sleep_clear_ext1_wakeup_io`` instead.
|
* ``esp_sleep_enable_ext1_wakeup_with_level_mask`` is deprecated, use ``esp_sleep_enable_ext1_wakeup_io`` and ``esp_sleep_clear_ext1_wakeup_io`` instead.
|
||||||
|
@@ -248,15 +248,13 @@ RTC 控制器中内嵌定时器,可用于在预定义的时间到达后唤醒
|
|||||||
gpio_pullup_dis(gpio_num);
|
gpio_pullup_dis(gpio_num);
|
||||||
gpio_pulldown_en(gpio_num);
|
gpio_pulldown_en(gpio_num);
|
||||||
|
|
||||||
可调用 :cpp:func:`esp_sleep_set_ext1_wakeup_io` 函数可用于增加 ext1 唤醒 IO 并设置相应的唤醒电平。
|
可调用 :cpp:func:`esp_sleep_enable_ext1_wakeup_io` 函数可用于增加 ext1 唤醒 IO 并设置相应的唤醒电平。
|
||||||
|
|
||||||
可调用 :cpp:func:`esp_sleep_clear_ext1_wakeup_io` 函数可用于移除 ext1 唤醒 IO。
|
可调用 :cpp:func:`esp_sleep_clear_ext1_wakeup_io` 函数可用于移除 ext1 唤醒 IO。
|
||||||
|
|
||||||
可调用 :cpp:func:`esp_sleep_enable_ext1_wakeup` 函数可用于重置所有先前的 ext1 唤醒配置,并启用新的 ext1 唤醒 IO 并设置相应的唤醒电平。
|
|
||||||
|
|
||||||
.. only:: SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN
|
.. only:: SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN
|
||||||
|
|
||||||
当前的 RTC 控制器也包含更强大的逻辑,允许配置的 IO 同时使用不同的唤醒电平。这可以通过:cpp:func:`esp_sleep_set_ext1_wakeup_io` 函数来进行配置。
|
当前的 RTC 控制器也包含更强大的逻辑,允许配置的 IO 同时使用不同的唤醒电平。这可以通过:cpp:func:`esp_sleep_enable_ext1_wakeup_io` 函数来进行配置。
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
|
@@ -217,7 +217,7 @@ static int deep_sleep(int argc, char **argv)
|
|||||||
io_num, level ? "HIGH" : "LOW");
|
io_num, level ? "HIGH" : "LOW");
|
||||||
|
|
||||||
#if SOC_PM_SUPPORT_EXT1_WAKEUP
|
#if SOC_PM_SUPPORT_EXT1_WAKEUP
|
||||||
ESP_ERROR_CHECK( esp_sleep_set_ext1_wakeup_io(1ULL << io_num, level) );
|
ESP_ERROR_CHECK( esp_sleep_enable_ext1_wakeup_io(1ULL << io_num, level) );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -151,7 +151,7 @@ static void ot_deep_sleep_init(void)
|
|||||||
// The configuration mode depends on your hardware design.
|
// The configuration mode depends on your hardware design.
|
||||||
// Since the BOOT button is connected to a pull-up resistor, the wake-up mode is configured as LOW.
|
// Since the BOOT button is connected to a pull-up resistor, the wake-up mode is configured as LOW.
|
||||||
const uint64_t ext_wakeup_mode = 0;
|
const uint64_t ext_wakeup_mode = 0;
|
||||||
ESP_ERROR_CHECK(esp_sleep_set_ext1_wakeup_io(gpio_wakeup_pin_mask, ext_wakeup_mode));
|
ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(gpio_wakeup_pin_mask, ext_wakeup_mode));
|
||||||
|
|
||||||
// Also these two GPIO configurations are also depended on the hardware design.
|
// Also these two GPIO configurations are also depended on the hardware design.
|
||||||
// The BOOT button is connected to the pull-up resistor, so enable the pull-up mode and disable the pull-down mode.
|
// The BOOT button is connected to the pull-up resistor, so enable the pull-up mode and disable the pull-down mode.
|
||||||
|
@@ -82,7 +82,7 @@ static int deep_sleep(int argc, char **argv)
|
|||||||
ESP_LOGI(TAG, "Enabling wakeup on GPIO%d, wakeup on %s level",
|
ESP_LOGI(TAG, "Enabling wakeup on GPIO%d, wakeup on %s level",
|
||||||
io_num, level ? "HIGH" : "LOW");
|
io_num, level ? "HIGH" : "LOW");
|
||||||
|
|
||||||
ESP_ERROR_CHECK( esp_sleep_set_ext1_wakeup_io(1ULL << io_num, level) );
|
ESP_ERROR_CHECK( esp_sleep_enable_ext1_wakeup_io(1ULL << io_num, level) );
|
||||||
ESP_LOGE(TAG, "GPIO wakeup from deep sleep currently unsupported on ESP32-C3");
|
ESP_LOGE(TAG, "GPIO wakeup from deep sleep currently unsupported on ESP32-C3");
|
||||||
}
|
}
|
||||||
#endif // SOC_PM_SUPPORT_EXT1_WAKEUP
|
#endif // SOC_PM_SUPPORT_EXT1_WAKEUP
|
||||||
|
@@ -40,10 +40,10 @@ void example_deep_sleep_register_ext1_wakeup(void)
|
|||||||
printf("Enabling EXT1 wakeup on pins GPIO%d, GPIO%d\n", ext_wakeup_pin_1, ext_wakeup_pin_2);
|
printf("Enabling EXT1 wakeup on pins GPIO%d, GPIO%d\n", ext_wakeup_pin_1, ext_wakeup_pin_2);
|
||||||
|
|
||||||
#if SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN
|
#if SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN
|
||||||
ESP_ERROR_CHECK(esp_sleep_set_ext1_wakeup_io(ext_wakeup_pin_1_mask, CONFIG_EXAMPLE_EXT1_WAKEUP_MODE_PIN_1));
|
ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(ext_wakeup_pin_1_mask, CONFIG_EXAMPLE_EXT1_WAKEUP_MODE_PIN_1));
|
||||||
ESP_ERROR_CHECK(esp_sleep_set_ext1_wakeup_io(ext_wakeup_pin_2_mask, CONFIG_EXAMPLE_EXT1_WAKEUP_MODE_PIN_2));
|
ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(ext_wakeup_pin_2_mask, CONFIG_EXAMPLE_EXT1_WAKEUP_MODE_PIN_2));
|
||||||
#else
|
#else
|
||||||
ESP_ERROR_CHECK(esp_sleep_set_ext1_wakeup_io(ext_wakeup_pin_1_mask | ext_wakeup_pin_2_mask, CONFIG_EXAMPLE_EXT1_WAKEUP_MODE));
|
ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(ext_wakeup_pin_1_mask | ext_wakeup_pin_2_mask, CONFIG_EXAMPLE_EXT1_WAKEUP_MODE));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If there are no external pull-up/downs, tie wakeup pins to inactive level with internal pull-up/downs via RTC IO
|
/* If there are no external pull-up/downs, tie wakeup pins to inactive level with internal pull-up/downs via RTC IO
|
||||||
|
Reference in New Issue
Block a user