Pages: [1]   Go Down
Author Topic: eeprom_update_block missing eeprom.h  (Read 801 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 1
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

USA
Offline Offline
Full Member
***
Karma: 0
Posts: 238
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 76
Posts: 2247
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Offline Offline
Newbie
*
Karma: 1
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 76
Posts: 2247
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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.
Logged


Pages: [1]   Go Up
Jump to: