Fix file.open in STM32 eeprom emu

This commit is contained in:
Scott Lahteine 2019-05-16 20:43:20 -05:00
parent 06f3273531
commit 0b056970c6

View File

@ -64,11 +64,11 @@ static char HAL_STM32F1_eeprom_content[HAL_STM32F1_EEPROM_SIZE];
if (!card.isDetected()) return false; if (!card.isDetected()) return false;
SdFile file, root = card.getroot(); SdFile file, root = card.getroot();
if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) int16_t bytes_written = 0;
return false; if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) {
bytes_written = file.write(HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
int16_t bytes_written = file.write(HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
file.close(); file.close();
}
return (bytes_written == HAL_STM32F1_EEPROM_SIZE); return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
} }