-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added wasRestored(), bumped version to 1.2.1
- Loading branch information
Showing
5 changed files
with
21 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name=ESP32_RTC_EEPROM | ||
version=0.2.0 | ||
version=0.2.1 | ||
author=Rop Gonggrijp <[email protected]> | ||
maintainer=Rop Gonggrijp <[email protected]> | ||
sentence=EEPROM emulation that stores in RTC RAM. Survives deep sleep, but not reset or power loss. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
-ported by Paolo Becchi to Esp32 from esp8266 EEPROM | ||
-Modified by Elochukwu Ifediora <[email protected]> | ||
-Converted to nvs [email protected] | ||
-Adapted for ESP32_RTC_EEPROM.cpp by Rop Gonggrijp | ||
-Adapted for ESP32_RTC_EEPROM.cpp by Rop Gonggrijp <[email protected]> | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
|
@@ -31,6 +31,8 @@ uint8_t RTC_DATA_ATTR EEPROMClass::_data[EEPROM_SIZE] = { 0x23, 0x42, 0x23, 0x42 | |
|
||
size_t EEPROMClass::_size = EEPROM_SIZE; | ||
|
||
bool EEPROMClass::_restored = false; | ||
|
||
|
||
EEPROMClass::EEPROMClass(void) | ||
{ | ||
|
@@ -92,6 +94,10 @@ bool EEPROMClass::toNVS() { | |
return true; | ||
} | ||
|
||
bool EEPROMClass::wasRestored() { | ||
return _restored; | ||
} | ||
|
||
bool EEPROMClass::begin(size_t size) { | ||
if (!size || size > EEPROM_SIZE) { | ||
return false; | ||
|
@@ -109,6 +115,7 @@ bool EEPROMClass::begin(size_t size) { | |
*magic_word = 0; | ||
} else { | ||
log_w("RTC EEPROM contents recovered from NVS backup."); | ||
_restored = true; | ||
} | ||
} | ||
return true; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
-ported by Paolo Becchi to Esp32 from esp8266 EEPROM | ||
-Modified by Elochukwu Ifediora <[email protected]> | ||
-Converted to nvs [email protected] | ||
-Adapted for ESP32_RTC_EEPROM.cpp by Rop Gonggrijp | ||
-Adapted for ESP32_RTC_EEPROM.cpp by Rop Gonggrijp <[email protected]> | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
|
@@ -41,6 +41,7 @@ class EEPROMClass { | |
static bool begin(size_t size); | ||
static bool fromNVS(); | ||
static bool toNVS(); | ||
static bool wasRestored(); | ||
static uint8_t read(int address); | ||
static void write(int address, uint8_t val); | ||
static uint16_t length(); | ||
|
@@ -108,6 +109,7 @@ class EEPROMClass { | |
protected: | ||
static size_t _size; | ||
static uint8_t RTC_DATA_ATTR _data[EEPROM_SIZE]; | ||
static bool _restored; | ||
}; | ||
|
||
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_EEPROM) | ||
|