Go Down

Topic: eeprom_update_block missing eeprom.h (Read 833 times) previous topic - next topic

hengis

It appears that the C++ instruction eeprom_update_block  is missing.  Does anybody have a work a round for this missing instruction

mkwired

Those "update" functions came out in version 1.7.0 of avr-libc.  Arduino is using an older avr-libc (v1.6.4).

pYro_65

eeprom_update_block  just checks if the data is different before writing, whereas eeprom_write_block just writes.

It is fairly straight forward enough to implement.

hengis

Thanks for your input guys.  I am really at sea here.  Help with a few lines of code to replace eeprom_update_block would be really handy.  I do not know if this is a big problem or not.

pYro_65

I already gave you the information you needed, did you investigate anything?
Look at the documentation, that what it is there for. If you don't understand: www.cplusplus.com/doc/tutorial/

Along with the 1,000,000 other pages with information on it. You will find what you need in 5 minutes if you tried.

Use the function eeprom_read_byte, it is easier than blocks, change when you are comfortable with c++.

Code: [Select]
char arr[] = { 1,2,3,4,5 };

for( int i = 0 ; i < 5 ; ++i ){

  if( eeprom_read_byte( ( uint8_t* ) i ) != arr[ i ] ){
 
    eeprom_write_byte( ( uint8_t* ) i, arr[ i ] );
  }
}


If you want a function, create one, pass an index, read its data, if different write it to eeprom. Simple.

Go Up