mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
feat(pm): add internal pull-up/downs option for gpio used for deepsleep wakeup
This commit is contained in:
@ -91,6 +91,13 @@ menu "Hardware Settings"
|
|||||||
To reduce leakage current, some types of SPI Flash/RAM only need to pull up the CS pin
|
To reduce leakage current, some types of SPI Flash/RAM only need to pull up the CS pin
|
||||||
during light sleep. But there are also some kinds of SPI Flash/RAM that need to pull up
|
during light sleep. But there are also some kinds of SPI Flash/RAM that need to pull up
|
||||||
all pins. It depends on the SPI Flash/RAM chip used.
|
all pins. It depends on the SPI Flash/RAM chip used.
|
||||||
|
|
||||||
|
config ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS
|
||||||
|
bool "Allow to enable internal pull-up/downs for the Deep-Sleep wakeup IOs"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
When using rtc gpio wakeup source during deepsleep without external pull-up/downs, you may want to
|
||||||
|
make use of the internal ones.
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
menu "ESP_SLEEP_WORKAROUND"
|
menu "ESP_SLEEP_WORKAROUND"
|
||||||
|
@ -245,9 +245,13 @@ esp_err_t esp_sleep_enable_ext1_wakeup(uint64_t mask, esp_sleep_ext1_wakeup_mode
|
|||||||
* @note This function does not modify pin configuration. The pins are
|
* @note This function does not modify pin configuration. The pins are
|
||||||
* configured inside esp_deep_sleep_start, immediately before entering sleep mode.
|
* configured inside esp_deep_sleep_start, immediately before entering sleep mode.
|
||||||
*
|
*
|
||||||
* @note You don't need to care to pull-up or pull-down before using this
|
* @note You don't need to worry about pull-up or pull-down resistors before
|
||||||
* function, because this will be set internally in esp_deep_sleep_start
|
* using this function because the ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS
|
||||||
* based on the wakeup mode. BTW, when you use low level to wake up the
|
* option is enabled by default. It will automatically set pull-up or pull-down
|
||||||
|
* resistors internally in esp_deep_sleep_start based on the wakeup mode. However,
|
||||||
|
* when using external pull-up or pull-down resistors, please be sure to disable
|
||||||
|
* the ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS option, as the combination of internal
|
||||||
|
* and external resistors may cause interference. BTW, when you use low level to wake up the
|
||||||
* chip, we strongly recommend you to add external resistors (pull-up).
|
* chip, we strongly recommend you to add external resistors (pull-up).
|
||||||
*
|
*
|
||||||
* @param gpio_pin_mask Bit mask of GPIO numbers which will cause wakeup. Only GPIOs
|
* @param gpio_pin_mask Bit mask of GPIO numbers which will cause wakeup. Only GPIOs
|
||||||
|
@ -1165,6 +1165,7 @@ static void gpio_deep_sleep_wakeup_prepare(void)
|
|||||||
if (((1ULL << gpio_idx) & s_config.gpio_wakeup_mask) == 0) {
|
if (((1ULL << gpio_idx) & s_config.gpio_wakeup_mask) == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#if CONFIG_ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS
|
||||||
if (s_config.gpio_trigger_mode & BIT(gpio_idx)) {
|
if (s_config.gpio_trigger_mode & BIT(gpio_idx)) {
|
||||||
ESP_ERROR_CHECK(gpio_pullup_dis(gpio_idx));
|
ESP_ERROR_CHECK(gpio_pullup_dis(gpio_idx));
|
||||||
ESP_ERROR_CHECK(gpio_pulldown_en(gpio_idx));
|
ESP_ERROR_CHECK(gpio_pulldown_en(gpio_idx));
|
||||||
@ -1172,6 +1173,7 @@ static void gpio_deep_sleep_wakeup_prepare(void)
|
|||||||
ESP_ERROR_CHECK(gpio_pullup_en(gpio_idx));
|
ESP_ERROR_CHECK(gpio_pullup_en(gpio_idx));
|
||||||
ESP_ERROR_CHECK(gpio_pulldown_dis(gpio_idx));
|
ESP_ERROR_CHECK(gpio_pulldown_dis(gpio_idx));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
ESP_ERROR_CHECK(gpio_hold_en(gpio_idx));
|
ESP_ERROR_CHECK(gpio_hold_en(gpio_idx));
|
||||||
}
|
}
|
||||||
// Clear state from previous wakeup
|
// Clear state from previous wakeup
|
||||||
|
Reference in New Issue
Block a user