// In-memory EEPROM for the native tests (starts erased, all 0xFF like a new chip) #pragma once #include #include class FakeEEPROM { public: uint8_t mem[1024]; FakeEEPROM() { erase(); } void erase() { memset(mem, 0xFF, sizeof(mem)); } 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; } }; inline FakeEEPROM EEPROM;