Skip to content

Instantly share code, notes, and snippets.

@surinoel
Created July 13, 2019 16:28
Show Gist options
  • Save surinoel/4c8758db59d070baca56f3193f74c31b to your computer and use it in GitHub Desktop.
Save surinoel/4c8758db59d070baca56f3193f74c31b to your computer and use it in GitHub Desktop.
#define EEPROM_PAGE_SIZE 16
#define EEPROM_TOTAL_BYTE 128
void EEPROM_eraseALL(void)
{
uint8_t i;
uint16_t pageAddress = 0;
while(pageAddress < EEPROM_TOTAL_BYTE) {
EEPROM_writeEnable();
EEPROM_Select();
EEPROM_changeByte(EERPOM_WRITE);
EEPROM_sendAddress(pageAddress);
for(i=0; i<EEPROM_PAGE_SIZE; i++) {
EEPROM_changeByte(0);
}
EEPROM_DeSelect();
pageAddress += EEPROM_PAGE_SIZE;
while(EEPROM_readStatus() & _BV(0));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment