1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-23 12:04:19 +00:00

HAL_STM32F1_EEPROM_SIZE => HAL_EEPROM_SIZE

This commit is contained in:
Scott Lahteine 2019-08-02 05:36:00 -05:00
parent ee5e46b46b
commit e1942715ce

View File

@ -36,10 +36,10 @@
#ifndef E2END
#define E2END 0xFFF // 4KB
#endif
#define HAL_STM32F1_EEPROM_SIZE (E2END + 1)
#define HAL_EEPROM_SIZE (E2END + 1)
#define _ALIGN(x) __attribute__ ((aligned(x))) // SDIO uint32_t* compat.
static char _ALIGN(4) HAL_eeprom_data[HAL_STM32F1_EEPROM_SIZE];
static char _ALIGN(4) HAL_eeprom_data[HAL_EEPROM_SIZE];
#if ENABLED(SDSUPPORT)
@ -54,9 +54,9 @@ static char _ALIGN(4) HAL_eeprom_data[HAL_STM32F1_EEPROM_SIZE];
if (!file.open(&root, EEPROM_FILENAME, O_RDONLY))
return false;
int bytes_read = file.read(HAL_eeprom_data, HAL_STM32F1_EEPROM_SIZE);
int bytes_read = file.read(HAL_eeprom_data, HAL_EEPROM_SIZE);
if (bytes_read < 0) return false;
for (; bytes_read < HAL_STM32F1_EEPROM_SIZE; bytes_read++)
for (; bytes_read < HAL_EEPROM_SIZE; bytes_read++)
HAL_eeprom_data[bytes_read] = 0xFF;
file.close();
return true;
@ -68,10 +68,10 @@ static char _ALIGN(4) HAL_eeprom_data[HAL_STM32F1_EEPROM_SIZE];
SdFile file, root = card.getroot();
int bytes_written = 0;
if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) {
bytes_written = file.write(HAL_eeprom_data, HAL_STM32F1_EEPROM_SIZE);
bytes_written = file.write(HAL_eeprom_data, HAL_EEPROM_SIZE);
file.close();
}
return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
return (bytes_written == HAL_EEPROM_SIZE);
}
#else // !SDSUPPORT
@ -98,7 +98,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
return false;
}
size_t PersistentStore::capacity() { return HAL_STM32F1_EEPROM_SIZE; }
size_t PersistentStore::capacity() { return HAL_EEPROM_SIZE; }
#endif // EEPROM_SETTINGS