11/*
22 ESP32 eeprom_class example with EEPROM library
3-
43 This simple example demonstrates using EEPROM library to store different data in
5- ESP32 Flash memory in a multiple user-defined EEPROM partition (0x1000 or 4KB max size or less).
6-
7- Install 'ESP32 Partiton Manager' ONCE from https://github.com/francis94c/ESP32Partitions
8- And generate different partitions with 'partition_name'
9- Usage: EEPROMClass ANY_OBJECT_NAME("partition_name", size);
4+ ESP32 Flash memory in a multiple user-defined EEPROM class objects.
105
11- Generated partition that would work perfectly with this example
12- #Name, Type, SubType, Offset, Size, Flags
13- nvs, data, nvs, 0x9000, 0x5000,
14- otadata, data, ota, 0xe000, 0x2000,
15- app0, app, ota_0, 0x10000, 0x140000,
16- app1, app, ota_1, 0x150000, 0x140000,
17- eeprom0, data, 0x99, 0x290000, 0x1000,
18- eeprom1, data, 0x9a, 0x291000, 0x500,
19- eeprom2, data, 0x9b, 0x292000, 0x100,
20- spiffs, data, spiffs, 0x293000, 0x16d000,
21-
226 Created for arduino-esp32 on 25 Dec, 2017
237 by Elochukwu Ifediora (fedy0)
8+ converted to nvs by lbernstone - 06/22/2019
249*/
2510
2611#include " EEPROM.h"
2712
28- // Instantiate eeprom objects with parameter/argument names and size same as in the partition table
13+ // Instantiate eeprom objects with parameter/argument names and sizes
2914EEPROMClass NAMES (" eeprom0" , 0x500 );
3015EEPROMClass HEIGHT (" eeprom1" , 0x200 );
3116EEPROMClass AGE (" eeprom2" , 0x100 );
3217
3318void setup () {
34- // put your setup code here, to run once:
3519 Serial.begin (115200 );
3620 Serial.println (" Testing EEPROMClass\n " );
3721 if (!NAMES.begin (NAMES.length ())) {
@@ -57,7 +41,7 @@ void setup() {
5741 double height = 5.8 ;
5842 uint32_t age = 47 ;
5943
60- // Write: Variables ---> EEPROM partitions
44+ // Write: Variables ---> EEPROM stores
6145 NAMES.put (0 , name);
6246 HEIGHT.put (0 , height);
6347 AGE.put (0 , age);
@@ -75,7 +59,7 @@ void setup() {
7559 Serial.print (" age: " ); Serial.println (age);
7660 Serial.println (" ------------------------------------\n " );
7761
78- // Read: Variables <--- EEPROM partitions
62+ // Read: Variables <--- EEPROM stores
7963 NAMES.get (0 , name);
8064 HEIGHT.get (0 , height);
8165 AGE.get (0 , age);
@@ -87,6 +71,5 @@ void setup() {
8771}
8872
8973void loop () {
90- // put your main code here, to run repeatedly:
91-
74+ delay (0xFFFFFFFF );
9275}
0 commit comments