EEPROM.put

Post here first, or if you can't find a relevant section!
Post Reply
.rpv
Posts: 43
Joined: Wed Dec 18, 2019 10:19 pm

Re: EEPROM.put

Post 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.
Post Reply

Return to “General discussion”