AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/ports/xplained/ASF/xmega/drivers/nvm/nvm.c
void nvm_eeprom_erase_bytes_in_page(uint8_t page_addr)
{
    // Wait until NVM is ready
    nvm_wait_until_ready();

    // Calculate page address
    uint16_t address = (uint16_t) (page_addr * EEPROM_PAGE_SIZE);

    Assert(address <= EEPROM_SIZE);

    // Set address
    NVM.ADDR2 = 0x00;
    NVM.ADDR1 = (address >> 8) & 0xFF;
    NVM.ADDR0 = address & 0xFF;

    // Issue EEPROM Erase command
    nvm_issue_command(NVM_CMD_ERASE_EEPROM_PAGE_gc);
}
/**
 * \brief Erase bytes from EEPROM page.
 *
 * This function erases bytes from one EEPROM page, so that every location
 * written to in the page buffer reads 0xFF.
 *
 * \param page_addr EEPROM Page address, between 0 and EEPROM_SIZE/EEPROM_PAGE_SIZE
 */
\brief Erase bytes from EEPROM page.
This function erases bytes from one EEPROM page, so that every location
written to in the page buffer reads 0xFF.


\ brief Erase bytes from EEPROM page . This function erases bytes from one EEPROM page so that every location written to in the page buffer reads 0xFF .
void nvm_eeprom_erase_bytes_in_page(uint8_t page_addr)
{
    nvm_wait_until_ready();
    uint16_t address = (uint16_t) (page_addr * EEPROM_PAGE_SIZE);
    Assert(address <= EEPROM_SIZE);
    NVM.ADDR2 = 0x00;
    NVM.ADDR1 = (address >> 8) & 0xFF;
    NVM.ADDR0 = address & 0xFF;
    nvm_issue_command(NVM_CMD_ERASE_EEPROM_PAGE_gc);
}
void nvm_eeprom_erase_bytes_in_page ( uint8_t page_addr ) { nvm_wait_until_ready ( ) ; uint16_t address = ( uint16_t ) ( page_addr * EEPROM_PAGE_SIZE ) ; Assert ( address <= EEPROM_SIZE ) ; NVM . ADDR2 = 0x00 ; NVM . ADDR1 = ( address >> 8 ) & 0xFF ; NVM . ADDR0 = address & 0xFF ; nvm_issue_command ( NVM_CMD_ERASE_EEPROM_PAGE_gc ) ; }
\brief Erase bytes from EEPROM page.
\ brief Erase bytes from EEPROM page .
// Wait until NVM is ready // Calculate page address // Set address // Issue EEPROM Erase command