|
@@ -36,10 +36,10 @@
|
36
|
36
|
#ifndef E2END
|
37
|
37
|
#define E2END 0xFFF // 4KB
|
38
|
38
|
#endif
|
39
|
|
-#define HAL_STM32F1_EEPROM_SIZE (E2END + 1)
|
|
39
|
+#define HAL_EEPROM_SIZE (E2END + 1)
|
40
|
40
|
|
41
|
41
|
#define _ALIGN(x) __attribute__ ((aligned(x))) // SDIO uint32_t* compat.
|
42
|
|
-static char _ALIGN(4) HAL_eeprom_data[HAL_STM32F1_EEPROM_SIZE];
|
|
42
|
+static char _ALIGN(4) HAL_eeprom_data[HAL_EEPROM_SIZE];
|
43
|
43
|
|
44
|
44
|
#if ENABLED(SDSUPPORT)
|
45
|
45
|
|
|
@@ -54,9 +54,9 @@ static char _ALIGN(4) HAL_eeprom_data[HAL_STM32F1_EEPROM_SIZE];
|
54
|
54
|
if (!file.open(&root, EEPROM_FILENAME, O_RDONLY))
|
55
|
55
|
return false;
|
56
|
56
|
|
57
|
|
- int bytes_read = file.read(HAL_eeprom_data, HAL_STM32F1_EEPROM_SIZE);
|
|
57
|
+ int bytes_read = file.read(HAL_eeprom_data, HAL_EEPROM_SIZE);
|
58
|
58
|
if (bytes_read < 0) return false;
|
59
|
|
- for (; bytes_read < HAL_STM32F1_EEPROM_SIZE; bytes_read++)
|
|
59
|
+ for (; bytes_read < HAL_EEPROM_SIZE; bytes_read++)
|
60
|
60
|
HAL_eeprom_data[bytes_read] = 0xFF;
|
61
|
61
|
file.close();
|
62
|
62
|
return true;
|
|
@@ -68,10 +68,10 @@ static char _ALIGN(4) HAL_eeprom_data[HAL_STM32F1_EEPROM_SIZE];
|
68
|
68
|
SdFile file, root = card.getroot();
|
69
|
69
|
int bytes_written = 0;
|
70
|
70
|
if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) {
|
71
|
|
- bytes_written = file.write(HAL_eeprom_data, HAL_STM32F1_EEPROM_SIZE);
|
|
71
|
+ bytes_written = file.write(HAL_eeprom_data, HAL_EEPROM_SIZE);
|
72
|
72
|
file.close();
|
73
|
73
|
}
|
74
|
|
- return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
|
|
74
|
+ return (bytes_written == HAL_EEPROM_SIZE);
|
75
|
75
|
}
|
76
|
76
|
|
77
|
77
|
#else // !SDSUPPORT
|
|
@@ -98,7 +98,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
|
98
|
98
|
return false;
|
99
|
99
|
}
|
100
|
100
|
|
101
|
|
-size_t PersistentStore::capacity() { return HAL_STM32F1_EEPROM_SIZE; }
|
|
101
|
+size_t PersistentStore::capacity() { return HAL_EEPROM_SIZE; }
|
102
|
102
|
|
103
|
103
|
#endif // EEPROM_SETTINGS
|
104
|
104
|
|