aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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();
}
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.