From 5df1cae92ccdb3f5f5a00c815296654f7ecf0d77 Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Wed, 16 Feb 2011 17:33:29 +0100 Subject: [PATCH] [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 --- mote/v2/avr/ctrl.c | 10 +++++----- mote/v2/avr/main.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mote/v2/avr/ctrl.c b/mote/v2/avr/ctrl.c index 4870dd0..eac09fb 100644 --- a/mote/v2/avr/ctrl.c +++ b/mote/v2/avr/ctrl.c @@ -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(); } diff --git a/mote/v2/avr/main.c b/mote/v2/avr/main.c index 24908b3..cbbac14 100644 --- a/mote/v2/avr/main.c +++ b/mote/v2/avr/main.c @@ -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++)