[avr] subsitute eeprom_write_block for eeprom_update_block so that a byte is written only when it differs from the value stored in EEPROM

This commit is contained in:
Bart Van Der Meerssche 2011-02-16 17:33:29 +01:00
parent acf658dd26
commit 5df1cae92c
2 changed files with 7 additions and 7 deletions

View File

@ -459,10 +459,10 @@ void ctrlCmdSet(uint8_t cmd)
void ctrlCmdCommit(void)
{
cli();
eeprom_write_block((const void*)&version, (void*)&EEPROM_version, sizeof(version));
eeprom_write_block((const void*)&event, (void*)&EEPROM_event, sizeof(event));
eeprom_write_block((const void*)&enabled, (void*)&EEPROM_enabled, sizeof(enabled));
eeprom_write_block((const void*)&phy_to_log, (void*)&EEPROM_phy_to_log, sizeof(phy_to_log));
eeprom_write_block((const void*)&sensor, (void*)&EEPROM_sensor, sizeof(sensor));
eeprom_update_block((const void*)&version, (void*)&EEPROM_version, sizeof(version));
eeprom_update_block((const void*)&event, (void*)&EEPROM_event, sizeof(event));
eeprom_update_block((const void*)&enabled, (void*)&EEPROM_enabled, sizeof(enabled));
eeprom_update_block((const void*)&phy_to_log, (void*)&EEPROM_phy_to_log, sizeof(phy_to_log));
eeprom_update_block((const void*)&sensor, (void*)&EEPROM_sensor, sizeof(sensor));
sei();
}

View File

@ -245,8 +245,8 @@ ISR(TIMER1_CAPT_vect)
event.brown_out++;
eeprom_write_block((const void*)&sensor, (void*)&EEPROM_sensor, sizeof(sensor));
eeprom_write_block((const void*)&event, (void*)&EEPROM_event, sizeof(event));
eeprom_update_block((const void*)&sensor, (void*)&EEPROM_sensor, sizeof(sensor));
eeprom_update_block((const void*)&event, (void*)&EEPROM_event, sizeof(event));
// uint8_t i;
// for (i=0; i<128; i++)