first commit

This commit is contained in:
2024-11-08 00:11:06 +06:00
commit 1e0915ac08
9 changed files with 532 additions and 0 deletions

24
state_manager.h Normal file
View File

@@ -0,0 +1,24 @@
#ifndef __STATE_MANAGER_H
#define __STATE_MANAGER_H
#include "simple_eeprom.h"
#define DEFAULT_STATE 0x0000
void save_state(uint16_t state) { eeprom_write(state); }
uint16_t load_state(void) { return eeprom_read(); }
void dump_eeprom(void) {
uint16_t *word = (uint16_t *)(EEPROM_BASE);
printf("EEPROM contents:");
for (int i = 0; i < 32; i++) {
uint16_t val = word[i];
// if (!(val & 0x8000)) {
printf(" %04X", val);
// }
}
printf("\n");
}
#endif