Page 1 of 1

Re: EEPROM.put

Posted: Fri Apr 10, 2020 12:02 am
by .rpv
Are you using Roger's Core, right?, I used this code on the sketch to add get/put functionality:

Code: Select all

template <class T> void eeGet(int ee,T& value){
	byte* p=(byte*)(void*)&value;
	unsigned int i;
	for(i=0;i<sizeof(value);i++)
		*p++=EEPROM.read(ee++);}

template <class T> void eePut(int ee,T& value){
	const byte* p=(const byte*)(const void*)&value;
	unsigned int i;
	for(i=0;i<sizeof(value);i++)
		EEPROM.write(ee++,*p++);}
The ST Core library has the get/put functions build in.

And for the i2c AT24Cxx external eeprom I use the uEEPROMLib.