27 lines
369 B
C++
27 lines
369 B
C++
|
|
||
|
#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);
|
||
|
}
|
||
|
};
|
||
|
|