#pragma once // Not used by robot/ today; here so a future robot-side EEPROM use doesn't // break the simulation build silently. Backed by RAM, starts erased (0xFF). #include class SimEEPROM { public: template T& get(int addr, T& t) { memcpy(&t, mem_ + addr, sizeof(T)); return t; } template const T& put(int addr, const T& t) { memcpy(mem_ + addr, &t, sizeof(T)); return t; } uint8_t read(int addr) { return mem_[addr]; } void write(int addr, uint8_t v) { mem_[addr] = v; } SimEEPROM() { memset(mem_, 0xFF, sizeof(mem_)); } private: uint8_t mem_[4284]; }; extern SimEEPROM EEPROM;