|
|
@@ -251,7 +251,7 @@ esp_err_t esp_sleep_enable_ext0_wakeup(gpio_num_t gpio_num, int level);
|
|
|
* It will work even if RTC peripherals are shut down during sleep.
|
|
|
*
|
|
|
* This feature can monitor any number of pins which are in RTC IOs.
|
|
|
- * Once any of the selected pins goes into the state given by mode argument,
|
|
|
+ * Once selected pins go into the state given by level_mode argument,
|
|
|
* the chip will be woken up.
|
|
|
*
|
|
|
* @note This function does not modify pin configuration. The pins are
|
|
|
@@ -267,28 +267,68 @@ esp_err_t esp_sleep_enable_ext0_wakeup(gpio_num_t gpio_num, int level);
|
|
|
* 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.
|
|
|
*
|
|
|
- * @param 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:
|
|
|
- * - ESP32: 0, 2, 4, 12-15, 25-27, 32-39
|
|
|
- * - ESP32-S2: 0-21
|
|
|
- * - ESP32-S3: 0-21
|
|
|
- * - ESP32-C6: 0-7
|
|
|
- * - ESP32-H2: 7-14
|
|
|
- * @param mode select logic function used to determine wakeup condition:
|
|
|
- * When target chip is ESP32:
|
|
|
- * - ESP_EXT1_WAKEUP_ALL_LOW: wake up when all selected GPIOs are low
|
|
|
- * - ESP_EXT1_WAKEUP_ANY_HIGH: wake up when any of the selected GPIOs is high
|
|
|
- * When target chip is ESP32-S2, ESP32-S3, ESP32-C6 or ESP32-H2:
|
|
|
- * - ESP_EXT1_WAKEUP_ANY_LOW: wake up when any of the selected GPIOs is low
|
|
|
- * - ESP_EXT1_WAKEUP_ANY_HIGH: wake up when any of the selected GPIOs is high
|
|
|
+ * @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:
|
|
|
+ * - ESP32: 0, 2, 4, 12-15, 25-27, 32-39
|
|
|
+ * - ESP32-S2: 0-21
|
|
|
+ * - ESP32-S3: 0-21
|
|
|
+ * - ESP32-C6: 0-7
|
|
|
+ * - ESP32-H2: 7-14
|
|
|
+ * @param level_mode Select logic function used to determine wakeup condition:
|
|
|
+ * When target chip is ESP32:
|
|
|
+ * - ESP_EXT1_WAKEUP_ALL_LOW: wake up when all selected GPIOs are low
|
|
|
+ * - ESP_EXT1_WAKEUP_ANY_HIGH: wake up when any of the selected GPIOs is high
|
|
|
+ * When target chip is ESP32-S2, ESP32-S3, ESP32-C6 or ESP32-H2:
|
|
|
+ * - ESP_EXT1_WAKEUP_ANY_LOW: wake up when any of the selected GPIOs is low
|
|
|
+ * - ESP_EXT1_WAKEUP_ANY_HIGH: wake up when any of the selected GPIOs is high
|
|
|
* @return
|
|
|
* - ESP_OK on success
|
|
|
* - ESP_ERR_INVALID_ARG if any of the selected GPIOs is not an RTC GPIO,
|
|
|
* or mode is invalid
|
|
|
*/
|
|
|
-esp_err_t esp_sleep_enable_ext1_wakeup(uint64_t mask, esp_sleep_ext1_wakeup_mode_t mode);
|
|
|
+esp_err_t esp_sleep_enable_ext1_wakeup(uint64_t io_mask, esp_sleep_ext1_wakeup_mode_t level_mode);
|
|
|
|
|
|
+#if SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN
|
|
|
+/**
|
|
|
+ * @brief Enable wakeup using multiple pins, allows different trigger mode per pin
|
|
|
+ *
|
|
|
+ * This function uses external wakeup feature of RTC controller.
|
|
|
+ * It will work even if RTC peripherals are shut down during sleep.
|
|
|
+ *
|
|
|
+ * This feature can monitor any number of pins which are in RTC IOs.
|
|
|
+ * Once selected pins go into the state given by level_mode argument,
|
|
|
+ * the chip will be woken up.
|
|
|
+ *
|
|
|
+ * @note This function does not modify pin configuration. The pins are
|
|
|
+ * configured in esp_deep_sleep_start/esp_light_sleep_start,
|
|
|
+ * immediately before entering sleep mode.
|
|
|
+ *
|
|
|
+ * @note Internal pullups and pulldowns don't work when RTC peripherals are
|
|
|
+ * shut down. In this case, external resistors need to be added.
|
|
|
+ * Alternatively, RTC peripherals (and pullups/pulldowns) may be
|
|
|
+ * kept enabled using esp_sleep_pd_config function. If we turn off the
|
|
|
+ * ``RTC_PERIPH`` domain or certain chips lack the ``RTC_PERIPH`` domain,
|
|
|
+ * we will use the HOLD feature to maintain the pull-up and pull-down on
|
|
|
+ * 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.
|
|
|
+ *
|
|
|
+ * @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:
|
|
|
+ * - ESP32-C6: 0-7.
|
|
|
+ * - ESP32-H2: 7-14.
|
|
|
+ * @param level_mask Select logic function used to determine wakeup condition per pin.
|
|
|
+ * Each bit of the level_mask corresponds to the respective GPIO. Each bit's corresponding
|
|
|
+ * position is set to 0, the wakeup level will be low, on the contrary,
|
|
|
+ * each bit's corresponding position is set to 1, the wakeup level will be high.
|
|
|
+ * @return
|
|
|
+ * - ESP_OK on success
|
|
|
+ * - ESP_ERR_INVALID_ARG if any of the selected GPIOs is not an RTC GPIO,
|
|
|
+ * or mode is invalid
|
|
|
+ */
|
|
|
+esp_err_t esp_sleep_enable_ext1_wakeup_with_level_mask(uint64_t io_mask, uint64_t level_mask);
|
|
|
+#endif // SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN
|
|
|
#endif // SOC_PM_SUPPORT_EXT1_WAKEUP
|
|
|
|
|
|
#if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
|