Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libraries/EEPROM/examples/eeprom_class/eeprom_class.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ void setup() {
Serial.begin(115200);
delay(1000);
Serial.println("Testing EEPROMClass\n");
if (!NAMES.begin(0x500)) {
if (!NAMES.begin(NAMES.capacity())) {
Serial.println("Failed to initialise NAMES");
Serial.println("Restarting...");
delay(1000);
ESP.restart();
}
if (!HEIGHT.begin(0x200)) {
if (!HEIGHT.begin(HEIGHT.capacity())) {
Serial.println("Failed to initialise HEIGHT");
Serial.println("Restarting...");
delay(1000);
ESP.restart();
}
if (!AGE.begin(0x100)) {
if (!AGE.begin(AGE.capacity())) {
Serial.println("Failed to initialise AGE");
Serial.println("Restarting...");
delay(1000);
Expand Down
8 changes: 8 additions & 0 deletions libraries/EEPROM/src/EEPROM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ uint8_t * EEPROMClass::getDataPtr() {
return &_data[0];
}

/*
Get EEPROM total size in byte defined by the user
*/
uint16_t EEPROMClass::capacity ()
{
return _size;
}

/*
Get EEPROM total size in byte defined by the user
*/
Expand Down
1 change: 1 addition & 0 deletions libraries/EEPROM/src/EEPROM.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class EEPROMClass {
bool begin(size_t size);
uint8_t read(int address);
void write(int address, uint8_t val);
uint16_t capacity();
uint16_t length();
bool commit();
void end();
Expand Down