1
1
/*
2
2
ESP32 eeprom_class example with EEPROM library
3
-
4
3
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.
10
5
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
-
22
6
Created for arduino-esp32 on 25 Dec, 2017
23
7
by Elochukwu Ifediora (fedy0)
8
+ converted to nvs by lbernstone - 06/22/2019
24
9
*/
25
10
26
11
#include " EEPROM.h"
27
12
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
29
14
EEPROMClass NAMES (" eeprom0" , 0x500 );
30
15
EEPROMClass HEIGHT (" eeprom1" , 0x200 );
31
16
EEPROMClass AGE (" eeprom2" , 0x100 );
32
17
33
18
void setup () {
34
- // put your setup code here, to run once:
35
19
Serial.begin (115200 );
36
20
Serial.println (" Testing EEPROMClass\n " );
37
21
if (!NAMES.begin (NAMES.length ())) {
@@ -57,7 +41,7 @@ void setup() {
57
41
double height = 5.8 ;
58
42
uint32_t age = 47 ;
59
43
60
- // Write: Variables ---> EEPROM partitions
44
+ // Write: Variables ---> EEPROM stores
61
45
NAMES.put (0 , name);
62
46
HEIGHT.put (0 , height);
63
47
AGE.put (0 , age);
@@ -75,7 +59,7 @@ void setup() {
75
59
Serial.print (" age: " ); Serial.println (age);
76
60
Serial.println (" ------------------------------------\n " );
77
61
78
- // Read: Variables <--- EEPROM partitions
62
+ // Read: Variables <--- EEPROM stores
79
63
NAMES.get (0 , name);
80
64
HEIGHT.get (0 , height);
81
65
AGE.get (0 , age);
@@ -87,6 +71,5 @@ void setup() {
87
71
}
88
72
89
73
void loop () {
90
- // put your main code here, to run repeatedly:
91
-
74
+ delay (0xFFFFFFFF );
92
75
}
0 commit comments