Files
TTGO_TWatch_Library/examples/BasicUnit/DeepSleep/DeepSleep.ino
2020-06-24 15:36:20 +08:00

27 lines
574 B
C++

#include "config.h"
TTGOClass *ttgo;
#define uS_TO_S_FACTOR 1000000ULL /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP 15 /* Time ESP32 will go to sleep (in seconds) */
void setup()
{
ttgo = TTGOClass::getWatch();
ttgo->begin();
ttgo->openBL();
ttgo->tft->fillScreen(rand() % 0xFFFF);
delay(3000);
ttgo->power->setPowerOutPut(0xFF, false);
ttgo->displaySleep();
esp_sleep_enable_timer_wakeup(uS_TO_S_FACTOR * TIME_TO_SLEEP);
esp_deep_sleep_start();
}
void loop()
{
}