Hi All,
Just to be sure: If using the EEPROMAnything to write/read to memory
Library:
template int EEPROM_writeAnything(int ee, const T& value)
{
const byte* p = (const byte*)(const void*)&value;
unsigned int i;
for (i = 0; i < sizeof(value); i++)
EEPROM.write(ee++, *p++);
return i;
}
code implementation
EEPROM_writeAnything(0, configuration); // configuration being some structure
Question .. ee in library & value 0 in code is the start byteposition in the memory-area written to, right?
So, if I save two 'configuration' structures, ee changes from 0 to SizeOf(configuration). .. Right?
mkwired,
The way you write the code confirms my question. The functions return size in bytes of the structure written so, you write
EEPROM_readAnything(0, configuration); // writes to start of memory
EEPROM_readAnything(sizeof(config_t), configuration2); // writes to next free memory-position