Put the EEPROM into Power Reduction Mode

In this application the XMEGA EEPROM block is not used, so it can be put into power reduction mode.

The register description for the NVM module can be found in section "Register Description – NVM Controller" of the XMEGA AU Manual. The NVM.CTRLB register, which will be used to disable the EEPROM is protected by the Configuration Change Protection (CCP) mechanism. Special care regarding timing needs to be taken when writing to this register. This project includes a function that handles this for you.

Below is the code:

// Disable EEPROM in NVM module.
ccp_write_io((void*)&NVM.CTRLB, NVM_EPRM_bm);