1 #ifndef EEPROMANYTHING_h
2 #define EEPROMANYTHING_h
5 #include <Arduino.h> // for type definitions
7 template <class T
> int EEPROM_writeAnything(int ee
, const T
& value
)
9 const byte
* p
= (const byte
*)(const void*)&value
;
11 for (i
= 0; i
< sizeof(value
); i
++)
12 EEPROM
.write(ee
++, *p
++);
16 template <class T
> int EEPROM_readAnything(int ee
, T
& value
)
18 byte
* p
= (byte
*)(void*)&value
;
20 for (i
= 0; i
< sizeof(value
); i
++)
21 *p
++ = EEPROM
.read(ee
++);
25 #endif // end EEPROMANYTHING