/* Set radio mode. 
The function also performs all required overrides for BLE and NRF mode. */
void radio_set_mode(enum radio_mode mode)
/* Set radio mode. 
The function also performs all required overrides for BLE and NRF mode. */
void radio_set_mode(enum radio_mode mode)
{
    volatile uint32_t* override_pos = 0;
    if ((RADIO_MODE_BLE_1MBIT == mode)
            && (FICR_OVERRIDEEN & ~FICR_OVERRIDEEN_BLE_1MBIT)) {
        override_pos = &FICR_BLE_1MBIT0;
    } else if ((RADIO_MODE_NRF_1MBIT == mode)
            && (FICR_OVERRIDEEN & ~FICR_OVERRIDEEN_NRF_1MBIT)) {
        override_pos = &FICR_NRF_1MBIT0;
    }
    if (override_pos) {
        uint8_t i;
        for (i = 0; i <= 4; ++i, ++override_pos) {
            RADIO_OVERRIDE(i) = *override_pos;
        }
        RADIO_OVERRIDE4 |= RADIO_OVERRIDE4_ENABLE;
    } else {
        RADIO_OVERRIDE4 &= ~RADIO_OVERRIDE4_ENABLE;
    }
    RADIO_MODE = mode;
}