libeerw.a (tastes great, less filling. maybe not)

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Don't ask me why people reinvent wheels (for learning, I suppose), but here is my eeprom library (my 'wheel')-

I was simply looking at the new eeprom stuff in libc, and just started trying my 'own thing'. Its not really tested (sim only), so there may be flaws in it. If anyone wants to try it, go ahead. If anyone wants to suggest improvements, go ahead.

My original thought was to try to make a read/write function that uses 'standard' call/return registers, combine read/write 1,2,4bytes and block read/write to 256bytes, be protected from interrupts modifying the eeprom registers, only one single 'version' capable of using either (of the 2) eeprom register locations, and as small as practical (asm). I also wanted to keep the header as 'code free' and simple as possible, 1 source file (now to a library), 1 'simple' header.

Since the eeprom address passed to the functions will always need to 'hard coded' by the compiler at compile time, and eeprom addresses seem to be limited to 0x0FFF, I figured those 4 unused bits could be used for something useful.

I just decided to try to make a library while I was at it, so thats why its a library (not a big deal).

(Somebody is now going to tell me there are more than 2 eeprom register 'locations' used by non-xmega avr's).