/* Function for filling a page in flash with a value.  */
static void flash_word_write(uint32_t *address, uint32_t value)
/* Function for filling a page in flash with a value.  */
static void flash_word_write(uint32_t *address, uint32_t value)
{
    NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos);
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
    {
    }
    *address = value;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
    {
    }
    NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos);
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
    {
    }
}