Swadge ESP32-S2/S3
APIs to develop for the Magfest Swadge
Loading...
Searching...
No Matches
hdw-sleep-switch.c File Reference

Functions

void rtc_sleep_enable_ultra_low (bool)
esp_err_t initSleepSwitch (gpio_num_t gpio)
 Initialize a GPIO as an RTC GPIO which monitors the sleep switch.
bool sleepSwitchShouldSleep (void)
 Check if the sleep switch should put the Swadge to sleep. This function does not call esp_deep_sleep_start(). That must be done by the caller after de-initializing the Swadge mode, hardware peripherals, etc.

Function Documentation

◆ rtc_sleep_enable_ultra_low()

void rtc_sleep_enable_ultra_low ( bool )
extern

◆ initSleepSwitch()

esp_err_t initSleepSwitch ( gpio_num_t gpio)

Initialize a GPIO as an RTC GPIO which monitors the sleep switch.

Parameters
gpioThe GPIO connected to the sleep switch. Must ben an RTC GPIO (GPIO_NUM_0 through GPIO_NUM_21 on ESP32-S3)
Returns
esp_err_t ESP_OK on success, or an ESP_ERR_ value

◆ sleepSwitchShouldSleep()

bool sleepSwitchShouldSleep ( void )

Check if the sleep switch should put the Swadge to sleep. This function does not call esp_deep_sleep_start(). That must be done by the caller after de-initializing the Swadge mode, hardware peripherals, etc.

Returns
true if the Swadge should enter deep sleep, false if it should stay awake