Cosa
Cosa copied to clipboard
EEPROM: Improve interface and implementation
Consider 1) using eeprom_update() instead of eeprom_write(), 2) add function to return EEPROM size, 3) using eeprom_update_block() and eeprom_read_block() instead of implementing them.
Use available constants (e.g. from iom328p.h):
#define RAMSTART (0x100)
#define RAMEND 0x8FF /* Last On-Chip SRAM Location */
#define XRAMSIZE 0
#define XRAMEND RAMEND
#define E2END 0x3FF
#define E2PAGESIZE 4
#define FLASHEND 0x7FFF
E2END+1 is the size of the EEPROM (1 Kbyte). RAMEND+1-RAMSTART is the size of the SRAM (2 Kbyte).