aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-eeprom.h
diff options
context:
space:
mode:
authorSelene ToyKeeper2017-08-26 17:12:31 -0600
committerSelene ToyKeeper2017-08-26 17:12:31 -0600
commit2370e0a3ce0a3ab928ac19af074a3ef67d533ca6 (patch)
tree50cafac4f25b9abab55eedd3cd305381302b347e /spaghetti-monster/fsm-eeprom.h
parentAdded eeprom load/save API (no wear levelling yet), verified it works in Dark... (diff)
downloadanduril-2370e0a3ce0a3ab928ac19af074a3ef67d533ca6.tar.gz
anduril-2370e0a3ce0a3ab928ac19af074a3ef67d533ca6.tar.bz2
anduril-2370e0a3ce0a3ab928ac19af074a3ef67d533ca6.zip
Made wear-levelling work. Takes a bunch of extra ROM though.
Also, I've only tested it a tiny amount.
Diffstat (limited to '')
-rw-r--r--spaghetti-monster/fsm-eeprom.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/spaghetti-monster/fsm-eeprom.h b/spaghetti-monster/fsm-eeprom.h
index 3d34f23..c35c822 100644
--- a/spaghetti-monster/fsm-eeprom.h
+++ b/spaghetti-monster/fsm-eeprom.h
@@ -33,6 +33,9 @@
#endif
#if EEPROM_BYTES > 0
+#if EEPROM_BYTES >= (EEPSIZE/2)
+#error Requested EEPROM_BYTES too big.
+#endif
uint8_t eeprom[EEPROM_BYTES];
uint8_t load_eeprom(); // returns 1 for success, 0 for no data found
void save_eeprom();
@@ -40,6 +43,9 @@ void save_eeprom();
#endif
#if EEPROM_WL_BYTES > 0
+#if EEPROM_WL_BYTES >= (EEPSIZE/4)
+#error Requested EEPROM_WL_BYTES too big.
+#endif
uint8_t eeprom_wl[EEPROM_WL_BYTES];
uint8_t load_wl_eeprom(); // returns 1 for success, 0 for no data found
void save_wl_eeprom();