|
@@ -28,20 +28,20 @@
|
28
|
28
|
|
29
|
29
|
#include "../shared/persistent_store_api.h"
|
30
|
30
|
|
31
|
|
-#if NONE(EEPROM_EMULATED_WITH_SRAM, SPI_EEPROM, I2C_EEPROM)
|
|
31
|
+#if NONE(SRAM_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
|
32
|
32
|
#include <EEPROM.h>
|
33
|
33
|
static bool eeprom_data_written = false;
|
34
|
34
|
#endif
|
35
|
35
|
|
36
|
36
|
bool PersistentStore::access_start() {
|
37
|
|
- #if NONE(EEPROM_EMULATED_WITH_SRAM, SPI_EEPROM, I2C_EEPROM)
|
|
37
|
+ #if NONE(SRAM_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
|
38
|
38
|
eeprom_buffer_fill();
|
39
|
39
|
#endif
|
40
|
40
|
return true;
|
41
|
41
|
}
|
42
|
42
|
|
43
|
43
|
bool PersistentStore::access_finish() {
|
44
|
|
- #if NONE(EEPROM_EMULATED_WITH_SRAM, SPI_EEPROM, I2C_EEPROM)
|
|
44
|
+ #if NONE(SRAM_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
|
45
|
45
|
if (eeprom_data_written) {
|
46
|
46
|
eeprom_buffer_flush();
|
47
|
47
|
eeprom_data_written = false;
|
|
@@ -66,7 +66,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
66
|
66
|
return true;
|
67
|
67
|
}
|
68
|
68
|
}
|
69
|
|
- #elif DISABLED(EEPROM_EMULATED_WITH_SRAM)
|
|
69
|
+ #elif DISABLED(SRAM_EEPROM_EMULATION)
|
70
|
70
|
eeprom_buffered_write_byte(pos, v);
|
71
|
71
|
#else
|
72
|
72
|
*(__IO uint8_t *)(BKPSRAM_BASE + (uint8_t * const)pos) = v;
|
|
@@ -76,7 +76,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
76
|
76
|
pos++;
|
77
|
77
|
value++;
|
78
|
78
|
};
|
79
|
|
- #if NONE(EEPROM_EMULATED_WITH_SRAM, SPI_EEPROM, I2C_EEPROM)
|
|
79
|
+ #if NONE(SRAM_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
|
80
|
80
|
eeprom_data_written = true;
|
81
|
81
|
#endif
|
82
|
82
|
|
|
@@ -89,7 +89,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
|
89
|
89
|
const uint8_t c = (
|
90
|
90
|
#if EITHER(SPI_EEPROM, I2C_EEPROM)
|
91
|
91
|
eeprom_read_byte((uint8_t*)pos)
|
92
|
|
- #elif DISABLED(EEPROM_EMULATED_WITH_SRAM)
|
|
92
|
+ #elif DISABLED(SRAM_EEPROM_EMULATION)
|
93
|
93
|
eeprom_buffered_read_byte(pos)
|
94
|
94
|
#else
|
95
|
95
|
(*(__IO uint8_t *)(BKPSRAM_BASE + ((uint8_t*)pos)))
|
|
@@ -107,7 +107,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
|
107
|
107
|
size_t PersistentStore::capacity() {
|
108
|
108
|
#if EITHER(SPI_EEPROM, I2C_EEPROM)
|
109
|
109
|
return E2END + 1;
|
110
|
|
- #elif DISABLED(EEPROM_EMULATED_WITH_SRAM)
|
|
110
|
+ #elif DISABLED(SRAM_EEPROM_EMULATION)
|
111
|
111
|
return E2END + 1;
|
112
|
112
|
#else
|
113
|
113
|
return 4096; // 4kB
|