Browse Source

HAL_STM32F1_EEPROM_SIZE => HAL_EEPROM_SIZE

pull/1/head
Scott Lahteine 5 years ago
parent
commit
e1942715ce
  1. 14
      Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp

14
Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp

@ -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

Loading…
Cancel
Save