59 #ifndef EEPROM_DRIVER_H 60 #define EEPROM_DRIVER_H 65 #define EEPROM_PAGESIZE 32 66 #define EEPROM(_pageAddr, _byteAddr) \ 67 ((uint8_t *) MAPPED_EEPROM_START)[_pageAddr*EEPROM_PAGESIZE + _byteAddr] 78 #define EEPROM_EnablePowerReduction() ( NVM.CTRLB |= NVM_EPRM_bm ) 84 #define EEPROM_DisablePowerReduction() ( NVM.CTRLB &= ~NVM_EPRM_bm ) 95 #define EEPROM_EnableMapping() ( NVM.CTRLB |= NVM_EEMAPEN_bm ) 102 #define EEPROM_DisableMapping() ( NVM.CTRLB &= ~NVM_EEMAPEN_bm ) 112 #define NVM_EXEC() asm("push r30" "\n\t" \ 116 "ldi r30, 0xCB" "\n\t" \ 117 "ldi r31, 0x01" "\n\t" \ 118 "ldi r16, 0xD8" "\n\t" \ 119 "ldi r18, 0x01" "\n\t" \ 120 "out 0x34, r16" "\n\t" \ 129 void EEPROM_WriteByte ( uint8_t pageAddr, uint8_t byteAddr, uint8_t value );
130 void EEPROM_WriteBytes ( uint8_t pageAddr, uint8_t byteAddr, uint8_t len, uint32_t value );
132 uint32_t EEPROM_ReadBytes ( uint8_t pageAddr, uint8_t byteAddr, uint8_t len );
142 void eeprom_demo (
void );
void EEPROM_SplitWritePage(uint8_t pageAddr)
Write (without erasing) EEPROM page.
Commonly used includes, types and macros.
void EEPROM_LoadPage(const uint8_t *values)
Load entire page into temporary EEPROM page buffer.
uint8_t EEPROM_ReadByte(uint8_t pageAddr, uint8_t byteAddr)
Read one byte from EEPROM using IO mapping.
void EEPROM_AtomicWritePage(uint8_t pageAddr)
Write already loaded page into EEPROM.
void EEPROM_WriteByte(uint8_t pageAddr, uint8_t byteAddr, uint8_t value)
Write one byte to EEPROM using IO mapping.
void EEPROM_FlushBuffer(void)
Flush temporary EEPROM page buffer.
void EEPROM_ErasePage(uint8_t pageAddress)
Erase EEPROM page.
void EEPROM_WaitForNVM(void)
Wait for any NVM access to finish, including EEPROM.
void EEPROM_EraseAll(void)
Erase entire EEPROM memory.
void EEPROM_LoadByte(uint8_t byteAddr, uint8_t value)
Load single byte into temporary page buffer.