ina219_app_wifi_g2/src/platform/Esp8266RTCUserMemory.cpp
// Struct data with the maximum size of 512 bytes can be stored
// in the RTC memory using the ESP-specifc APIs.
// The stored data can be retained between deep sleep cycles.
// However, the data might be lost after power cycling the ESP8266.
// Created Mar 30, 2016 by Macro Yau.
// This example code is in the public domain.
Struct data with the maximum size of 512 bytes can be stored
in the RTC memory using the ESP-specifc APIs.
The stored data can be retained between deep sleep cycles.
However, the data might be lost after power cycling the ESP8266.
Created Mar 30, 2016 by Macro Yau.
This example code is in the public domain.
Struct data with the maximum size of 512 bytes can be stored in the RTC memory using the ESP - specifc APIs . The stored data can be retained between deep sleep cycles . However the data might be lost after power cycling the ESP8266 . Created Mar 30 2016 by Macro Yau . This example code is in the public domain .
bool readRtcData( struct rtcData * data )
  {
    if (ESP.rtcUserMemoryRead(0, (uint32_t*) data, RTCDATA_SIZE )) {
      uint32_t crcOfData = CRC32::calculate((unsigned char*)(data->data), RTCDATA_PAYLOAD_SIZE );
      if (crcOfData == data->crc32) {
        return true;
      }
    }
    return false;
  }
bool readRtcData ( struct rtcData * data ) { if ( ESP . rtcUserMemoryRead ( 0 , ( uint32_t * ) data , RTCDATA_SIZE ) ) { uint32_t crcOfData = CRC32 :: calculate ( ( unsigned char * ) ( data -> data ) , RTCDATA_PAYLOAD_SIZE ) ; if ( crcOfData == data -> crc32 ) { return true ; } } return false ; }
Struct data with the maximum size of 512 bytes can be stored
in the RTC memory using the ESP-specifc APIs.
Struct data with the maximum size of 512 bytes can be stored in the RTC memory using the ESP - specifc APIs .