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