esp_system: Add soc_caps guards in esp_sleep.h

This commit is contained in:
Angus Gratton 2021-01-16 17:08:34 +11:00 committed by bot
parent 4026e7b250
commit d3ffaf4684
2 changed files with 17 additions and 2 deletions

View File

@ -95,6 +95,7 @@ typedef esp_sleep_source_t esp_sleep_wakeup_cause_t;
*/
esp_err_t esp_sleep_disable_wakeup_source(esp_sleep_source_t source);
#if SOC_ULP_SUPPORTED
/**
* @brief Enable wakeup by ULP coprocessor
* @note In revisions 0 and 1 of the ESP32, ULP wakeup source
@ -108,6 +109,8 @@ esp_err_t esp_sleep_disable_wakeup_source(esp_sleep_source_t source);
*/
esp_err_t esp_sleep_enable_ulp_wakeup(void);
#endif // SOC_ULP_SUPPORTED
/**
* @brief Enable wakeup by timer
* @param time_in_us time before wakeup, in microseconds
@ -117,6 +120,8 @@ esp_err_t esp_sleep_enable_ulp_wakeup(void);
*/
esp_err_t esp_sleep_enable_timer_wakeup(uint64_t time_in_us);
#if SOC_TOUCH_SENSOR_NUM > 0
/**
* @brief Enable wakeup by touch sensor
*
@ -144,6 +149,10 @@ esp_err_t esp_sleep_enable_touchpad_wakeup(void);
*/
touch_pad_t esp_sleep_get_touchpad_wakeup_status(void);
#endif // SOC_TOUCH_SENSOR_NUM > 0
#if SOC_PM_SUPPORT_EXT_WAKEUP
/**
* @brief Returns true if a GPIO number is valid for use as wakeup source.
*
@ -213,6 +222,8 @@ esp_err_t esp_sleep_enable_ext0_wakeup(gpio_num_t gpio_num, int level);
*/
esp_err_t esp_sleep_enable_ext1_wakeup(uint64_t mask, esp_sleep_ext1_wakeup_mode_t mode);
#endif // SOC_PM_SUPPORT_EXT_WAKEUP
/**
* @brief Enable wakeup from light sleep using GPIOs
*

View File

@ -789,6 +789,7 @@ static void touch_wakeup_prepare(void)
#endif
#if SOC_TOUCH_SENSOR_NUM > 0
esp_err_t esp_sleep_enable_touchpad_wakeup(void)
{
#if ((defined CONFIG_ESP32_RTC_EXT_CRYST_ADDIT_CURRENT) || (defined CONFIG_ESP32_RTC_EXT_CRYST_ADDIT_CURRENT_V2))
@ -813,18 +814,20 @@ touch_pad_t esp_sleep_get_touchpad_wakeup_status(void)
assert(ret == ESP_OK && "wakeup reason is RTC_TOUCH_TRIG_EN but SENS_TOUCH_MEAS_EN is zero");
return pad_num;
}
#endif // SOC_TOUCH_SENSOR_NUM > 0
#if SOC_PM_SUPPORT_EXT_WAKEUP
bool esp_sleep_is_valid_wakeup_gpio(gpio_num_t gpio_num)
{
#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
return RTC_GPIO_IS_VALID_GPIO(gpio_num);
#else
return GPIO_IS_VALID_GPIO(gpio_num);
#endif
#endif // SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
}
#if SOC_PM_SUPPORT_EXT_WAKEUP
esp_err_t esp_sleep_enable_ext0_wakeup(gpio_num_t gpio_num, int level)
{
if (level < 0 || level > 1) {
@ -931,6 +934,7 @@ uint64_t esp_sleep_get_ext1_wakeup_status(void)
}
return gpio_mask;
}
#endif // SOC_PM_SUPPORT_EXT_WAKEUP
esp_err_t esp_sleep_enable_gpio_wakeup(void)