1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

Add instantly option to deepSleep (#5052)

* Add instantly option to deepSleep

* Move system_deep_sleep_instant to a new deepSleepInstant function
This commit is contained in:
Anthony Elder
2018-08-19 09:46:33 +01:00
committed by Develo
parent 61cc11da22
commit 5c7dbf4e4b
3 changed files with 10 additions and 0 deletions

View File

@ -73,6 +73,8 @@ Some ESP-specific APIs related to deep sleep, RTC and flash memories are availab
``ESP.deepSleep(microseconds, mode)`` will put the chip into deep sleep. ``mode`` is one of ``WAKE_RF_DEFAULT``, ``WAKE_RFCAL``, ``WAKE_NO_RFCAL``, ``WAKE_RF_DISABLED``. (GPIO16 needs to be tied to RST to wake from deepSleep.) The chip can sleep for at most ``ESP.deepSleepMax()`` microseconds.
``ESP.deepSleepInstant(microseconds, mode)`` works similarly to ``ESP.deepSleep`` but sleeps instantly without waiting for WiFi to shutdown.
``ESP.rtcUserMemoryWrite(offset, &data, sizeof(data))`` and ``ESP.rtcUserMemoryRead(offset, &data, sizeof(data))`` allow data to be stored in and retrieved from the RTC user memory of the chip respectively. Total size of RTC user memory is 512 bytes, so ``offset + sizeof(data)`` shouldn't exceed 512. Data should be 4-byte aligned. The stored data can be retained between deep sleep cycles. However, the data might be lost after power cycling the chip.
``ESP.restart()`` restarts the CPU.