aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-05-14 16:49:14 -0600
committerSelene ToyKeeper2020-05-14 16:49:14 -0600
commit4958a769029f7d1f444c5662fc0bee54a377229e (patch)
treed31d866a2f6c824db8f3001cebb20ddf26e28a74 /spaghetti-monster
parentfixed build of "momentary" example UI (diff)
downloadanduril-4958a769029f7d1f444c5662fc0bee54a377229e.tar.gz
anduril-4958a769029f7d1f444c5662fc0bee54a377229e.tar.bz2
anduril-4958a769029f7d1f444c5662fc0bee54a377229e.zip
fixed eeprom_wl functions on attiny1634
(didn't build before, due to a data type mismatch)
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/fsm-eeprom.c20
1 files changed, 10 insertions, 10 deletions
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<EEPROM_WL_BYTES; i++) {
- eeprom_wl[i] = eeprom_read_byte((uint8_t *)(offset+1+i));
+ eeprom_wl[i] = eeprom_read_byte(offset+1+i);
}
}
sei();
@@ -105,22 +105,22 @@ void save_eeprom_wl() {
cli();
// erase old state
- EEP_OFFSET_T offset = eep_wl_prev_offset;
+ uint8_t * offset = eep_wl_prev_offset;
for (uint8_t i = 0; i < EEPROM_WL_BYTES+1; i ++) {
- eeprom_update_byte((uint8_t *)offset+i, 0xFF);
+ eeprom_update_byte(offset+i, 0xFF);
}
// save new state
offset += EEPROM_WL_BYTES+1;
- if (offset > 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<EEPROM_WL_BYTES; i++, offset++) {
- eeprom_update_byte((uint8_t *)(offset), eeprom_wl[i]);
+ eeprom_update_byte(offset, eeprom_wl[i]);
}
sei();
}