content
content
If you want to use some the the SDK-API functions have a look at this link http://bbs.espressif.com/viewtopic.php?f=5&t=286
The Documentation can be found here http://bbs.espressif.com/download/file.php?id=253
To use the API you have to include some header-files in your sketch. Below is a quick example of using the RTC-Memory-Write API to make a counter persistent even after using sleep + the following reset.
#include <Streaming.h> // Include API-Headers extern "C" { #include "ets_sys.h" #include "os_type.h" #include "osapi.h" #include "mem.h" #include "user_interface.h" #include "cont.h" } // Counter uint32_t i = 0; // Temporary buffer uint32_t b = 0; void setup() { Serial.begin(115200); // Call API-Function system_deep_sleep_set_option(4); // Call API-Function system_rtc_mem_read(64,&b,4) << endl; // Check if the value is within expected range if(b < 100000) i = b; } int lap = 0; void loop() { for(int c = 0; c < 50; c++) { Serial << i++ << " " << lap << endl; delay(10); } // Call API-Function system_rtc_mem_write(64,&i,4) << endl; delay(1000); // Call API-Function system_deep_sleep(10000000); lap++; }
content
content
content