tone-generator/eeprom.hpp

27 lines
369 B
C++
Raw Normal View History

2024-08-19 22:43:24 +10:00
#pragma once
#include <EEPROM.h>
namespace eeprom {
inline int address = 0;
inline void jump(int loc = 0) {
address = 0;
}
template <typename T>
inline void read(T& type) {
EEPROM.get(address, type);
address += sizeof(type);
}
template <typename T>
inline void write(const T& type) {
EEPROM.put(address, type);
address += sizeof(type);
}
};