From 25668f96e456602bf98a140e146e742b7d677288 Mon Sep 17 00:00:00 2001 From: songruo Date: Mon, 11 Apr 2022 13:58:00 +0800 Subject: [PATCH] gpio: fix wrong GPIO_IS_DEEP_SLEEP_WAKEUP_VALID_GPIO macro Closes https://github.com/espressif/esp-idf/issues/8733 (cherry picked from commit 0d52cb04dc3c6557167f32891b3c2eff5f516e64) --- components/driver/include/driver/gpio.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/driver/include/driver/gpio.h b/components/driver/include/driver/gpio.h index eeb63f74f8..089b500ce2 100644 --- a/components/driver/include/driver/gpio.h +++ b/components/driver/include/driver/gpio.h @@ -498,7 +498,8 @@ esp_err_t gpio_sleep_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull); #if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP -#define GPIO_IS_DEEP_SLEEP_WAKEUP_VALID_GPIO(gpio_num) ((gpio_num & ~SOC_GPIO_DEEP_SLEEP_WAKEUP_VALID_GPIO_MASK) == 0) +#define GPIO_IS_DEEP_SLEEP_WAKEUP_VALID_GPIO(gpio_num) ((gpio_num >= 0) && \ + (((1ULL << (gpio_num)) & SOC_GPIO_DEEP_SLEEP_WAKEUP_VALID_GPIO_MASK) != 0)) /** * @brief Enable GPIO deep-sleep wake-up function.