Hello,
I have successfully used the "Reading and Writing Data Structures to EEPROM" sketch from Playground with arduino IDE 21.
Here are the functions I use
template int EEPROM_WriteElement(byte * ee, const T& value)
{
const byte* p = (const byte*)(const void*)&value;
int i, j;
j = p-ee;
for (i = 0; i < sizeof(value); i++)
EEPROM.write(j++, *p++);
return i;
}
template int EEPROM_ReadElement(byte * ee, T& value)
{
byte* p = (byte*)(void*)&value;
int i;
int j;
j = p-ee;
for (i = 0; i < sizeof(value); i++)
*p++ = EEPROM.read(j++);
return i;
}
Yersteday, I have made the upgrade to Aduino IDE 22, and Surprise, my code could not compile
Here are the messages I've got
FuzzyMonitor:-1: error: expected ',' or '...' before '&' token
FuzzyMonitor:-1: error: ISO C++ forbids declaration of 'T' with no type
FuzzyMonitor:-1: error: 'T' has not been declared
Do somebody have an idea ?
Thanks