diff --git a/components/esp_hw_support/include/esp_sleep.h b/components/esp_hw_support/include/esp_sleep.h index 88d3985809..6fb1df4cba 100644 --- a/components/esp_hw_support/include/esp_sleep.h +++ b/components/esp_hw_support/include/esp_sleep.h @@ -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 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 * 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 * 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 * which have RTC functionality can be used in this bit map. * 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 * 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. @@ -403,7 +401,7 @@ esp_err_t esp_sleep_clear_ext1_wakeup_io(uint64_t io_mask); * or mode is invalid */ 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 diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index eb057a959a..29421ffbec 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -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 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) { return ESP_ERR_INVALID_ARG; diff --git a/components/esp_pm/test_apps/esp_pm/main/test_pm.c b/components/esp_pm/test_apps/esp_pm/main/test_pm.c index ac6e51446b..14c1d5c2cb 100644 --- a/components/esp_pm/test_apps/esp_pm/main/test_pm.c +++ b/components/esp_pm/test_apps/esp_pm/main/test_pm.c @@ -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); /* 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 */ ulp_insn_t ulp_code[] = { diff --git a/components/esp_system/test_apps/esp_system_unity_tests/main/test_sleep.c b/components/esp_system/test_apps/esp_system_unity_tests/main/test_sleep.c index 325bd1fe0e..d830f3f27c 100644 --- a/components/esp_system/test_apps/esp_system_unity_tests/main/test_sleep.c +++ b/components/esp_system/test_apps/esp_system_unity_tests/main/test_sleep.c @@ -416,7 +416,7 @@ TEST_CASE("wake up using ext1 when RTC_PERIPH is off (13 high)", "[deepsleep][ig { // This test needs external pulldown 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(); } @@ -425,9 +425,9 @@ TEST_CASE("wake up using ext1 when RTC_PERIPH is off (13 low)", "[deepsleep][ign // This test needs external pullup ESP_ERROR_CHECK(rtc_gpio_init(GPIO_NUM_13)); #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 - 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 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_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_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(); } @@ -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(esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON)); #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 - 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 esp_deep_sleep_start(); } diff --git a/docs/en/api-reference/system/sleep_modes.rst b/docs/en/api-reference/system/sleep_modes.rst index 10dfafcb62..8030cf20df 100644 --- a/docs/en/api-reference/system/sleep_modes.rst +++ b/docs/en/api-reference/system/sleep_modes.rst @@ -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_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_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 - 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:: diff --git a/docs/en/migration-guides/release-5.x/5.3/system.rst b/docs/en/migration-guides/release-5.x/5.3/system.rst index de3c7ead05..0747e0e77b 100644 --- a/docs/en/migration-guides/release-5.x/5.3/system.rst +++ b/docs/en/migration-guides/release-5.x/5.3/system.rst @@ -6,4 +6,4 @@ System 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. diff --git a/docs/zh_CN/api-reference/system/sleep_modes.rst b/docs/zh_CN/api-reference/system/sleep_modes.rst index ed02cb5f0b..bca4d8dcb3 100644 --- a/docs/zh_CN/api-reference/system/sleep_modes.rst +++ b/docs/zh_CN/api-reference/system/sleep_modes.rst @@ -248,15 +248,13 @@ RTC 控制器中内嵌定时器,可用于在预定义的时间到达后唤醒 gpio_pullup_dis(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_enable_ext1_wakeup` 函数可用于重置所有先前的 ext1 唤醒配置,并启用新的 ext1 唤醒 IO 并设置相应的唤醒电平。 - .. 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:: diff --git a/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/cmd_system.c b/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/cmd_system.c index f3dc53317b..59fe12c6e8 100644 --- a/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/cmd_system.c +++ b/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/cmd_system.c @@ -217,7 +217,7 @@ static int deep_sleep(int argc, char **argv) io_num, level ? "HIGH" : "LOW"); #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 } diff --git a/examples/openthread/ot_sleepy_device/deep_sleep/main/esp_ot_sleepy_device.c b/examples/openthread/ot_sleepy_device/deep_sleep/main/esp_ot_sleepy_device.c index 16aaa4eebd..64659f6db9 100644 --- a/examples/openthread/ot_sleepy_device/deep_sleep/main/esp_ot_sleepy_device.c +++ b/examples/openthread/ot_sleepy_device/deep_sleep/main/esp_ot_sleepy_device.c @@ -151,7 +151,7 @@ static void ot_deep_sleep_init(void) // 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. 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. // The BOOT button is connected to the pull-up resistor, so enable the pull-up mode and disable the pull-down mode. diff --git a/examples/system/console/advanced/components/cmd_system/cmd_system_sleep.c b/examples/system/console/advanced/components/cmd_system/cmd_system_sleep.c index 41a52c6b74..0dd3ef9a18 100644 --- a/examples/system/console/advanced/components/cmd_system/cmd_system_sleep.c +++ b/examples/system/console/advanced/components/cmd_system/cmd_system_sleep.c @@ -82,7 +82,7 @@ static int deep_sleep(int argc, char **argv) ESP_LOGI(TAG, "Enabling wakeup on GPIO%d, wakeup on %s level", 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"); } #endif // SOC_PM_SUPPORT_EXT1_WAKEUP diff --git a/examples/system/deep_sleep/main/ext_wakeup.c b/examples/system/deep_sleep/main/ext_wakeup.c index 9560fd685f..35dcaf4b94 100644 --- a/examples/system/deep_sleep/main/ext_wakeup.c +++ b/examples/system/deep_sleep/main/ext_wakeup.c @@ -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); #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_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_1_mask, CONFIG_EXAMPLE_EXT1_WAKEUP_MODE_PIN_1)); + ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(ext_wakeup_pin_2_mask, CONFIG_EXAMPLE_EXT1_WAKEUP_MODE_PIN_2)); #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 /* If there are no external pull-up/downs, tie wakeup pins to inactive level with internal pull-up/downs via RTC IO