Detab some HAL files

This commit is contained in:
Scott Lahteine
2018-01-05 10:25:42 -06:00
parent 1c41de16d4
commit 3319765034
2 changed files with 62 additions and 62 deletions

View File

@ -49,45 +49,45 @@ namespace PersistentStore {
char HAL_STM32F1_eeprom_content[HAL_STM32F1_EEPROM_SIZE];
bool access_start() {
if (!card.cardOK) return false;
int16_t bytes_read = 0;
const char eeprom_zero = 0xFF;
card.openFile((char *)CONFIG_FILE_NAME,true);
bytes_read = card.read (HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
if (bytes_read == -1) return false;
for (; bytes_read < HAL_STM32F1_EEPROM_SIZE; bytes_read++) {
HAL_STM32F1_eeprom_content[bytes_read] = eeprom_zero;
}
card.closefile();
return true;
if (!card.cardOK) return false;
int16_t bytes_read = 0;
const char eeprom_zero = 0xFF;
card.openFile((char *)CONFIG_FILE_NAME,true);
bytes_read = card.read (HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
if (bytes_read == -1) return false;
for (; bytes_read < HAL_STM32F1_EEPROM_SIZE; bytes_read++) {
HAL_STM32F1_eeprom_content[bytes_read] = eeprom_zero;
}
card.closefile();
return true;
}
bool access_finish(){
if (!card.cardOK) return false;
int16_t bytes_written = 0;
card.openFile((char *)CONFIG_FILE_NAME,true);
bytes_written = card.write (HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
card.closefile();
return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
if (!card.cardOK) return false;
int16_t bytes_written = 0;
card.openFile((char *)CONFIG_FILE_NAME,true);
bytes_written = card.write (HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
card.closefile();
return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
}
bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
for (int i = 0; i < size; i++) {
HAL_STM32F1_eeprom_content [pos + i] = value[i];
}
crc16(crc, value, size);
pos += size;
return false;
for (int i = 0; i < size; i++) {
HAL_STM32F1_eeprom_content [pos + i] = value[i];
}
crc16(crc, value, size);
pos += size;
return false;
}
bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc) {
for (int i = 0; i < size; i++) {
value[i] = HAL_STM32F1_eeprom_content [pos + i];
}
crc16(crc, value, size);
pos += size;
return false;
for (int i = 0; i < size; i++) {
value[i] = HAL_STM32F1_eeprom_content [pos + i];
}
crc16(crc, value, size);
pos += size;
return false;
}
} // PersistentStore::