From 4958a769029f7d1f444c5662fc0bee54a377229e Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 14 May 2020 16:49:14 -0600 Subject: fixed eeprom_wl functions on attiny1634 (didn't build before, due to a data type mismatch) --- spaghetti-monster/fsm-eeprom.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'spaghetti-monster/fsm-eeprom.c') diff --git a/spaghetti-monster/fsm-eeprom.c b/spaghetti-monster/fsm-eeprom.c index 77352cf..0de7e05 100644 --- a/spaghetti-monster/fsm-eeprom.c +++ b/spaghetti-monster/fsm-eeprom.c @@ -67,7 +67,7 @@ void save_eeprom() { #ifdef USE_EEPROM_WL uint8_t eeprom_wl[EEPROM_WL_BYTES]; -EEP_OFFSET_T eep_wl_prev_offset; +uint8_t * eep_wl_prev_offset; uint8_t load_eeprom_wl() { #ifdef LED_ENABLE_PIN @@ -77,11 +77,11 @@ uint8_t load_eeprom_wl() { cli(); // check if eeprom has been initialized; abort if it hasn't uint8_t found = 0; - EEP_OFFSET_T offset; + uint8_t * offset; for(offset = 0; - offset < EEP_WL_SIZE - EEPROM_WL_BYTES - 1; + offset < (uint8_t *)(EEP_WL_SIZE - EEPROM_WL_BYTES - 1); offset += (EEPROM_WL_BYTES + 1)) { - if (eeprom_read_byte((uint8_t *)offset) == EEP_MARKER) { + if (eeprom_read_byte(offset) == EEP_MARKER) { found = 1; eep_wl_prev_offset = offset; break; @@ -91,7 +91,7 @@ uint8_t load_eeprom_wl() { if (found) { // load the actual data for(uint8_t i=0; i EEP_WL_SIZE-EEPROM_WL_BYTES-1) offset = 0; + if (offset > (uint8_t *)(EEP_WL_SIZE-EEPROM_WL_BYTES-1)) offset = 0; eep_wl_prev_offset = offset; // marker byte // FIXME: write the marker last, to signal completed transaction - eeprom_update_byte((uint8_t *)offset, EEP_MARKER); + eeprom_update_byte(offset, EEP_MARKER); offset ++; // user data for(uint8_t i=0; i