From 7a7b697ff9360416faa7a5dc239c004518538903 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Wed, 8 Feb 2017 20:32:49 +0200 Subject: [PATCH] Add ESP::deepSleep(us) fixes: https://github.com/espressif/arduino-esp32/issues/51 --- cores/esp32/Esp.cpp | 6 ++++++ cores/esp32/Esp.h | 1 + 2 files changed, 7 insertions(+) diff --git a/cores/esp32/Esp.cpp b/cores/esp32/Esp.cpp index 7ce2aac8..70203701 100644 --- a/cores/esp32/Esp.cpp +++ b/cores/esp32/Esp.cpp @@ -20,6 +20,7 @@ #include "Arduino.h" #include "Esp.h" #include "rom/spi_flash.h" +#include "esp_deep_sleep.h" #include //#define DEBUG_SERIAL Serial @@ -80,6 +81,11 @@ unsigned long long operator"" _GB(unsigned long long x) EspClass ESP; +void EspClass::deepSleep(uint32_t time_us) +{ + esp_deep_sleep(time_us); +} + uint32_t EspClass::getCycleCount() { uint32_t ccount; diff --git a/cores/esp32/Esp.h b/cores/esp32/Esp.h index db90709a..02eb25ba 100644 --- a/cores/esp32/Esp.h +++ b/cores/esp32/Esp.h @@ -60,6 +60,7 @@ public: const char * getSdkVersion(); + void deepSleep(uint32_t time_us); uint8_t getCpuFreqMHz();