BLE advertising events

Hi,

Since BLE advertising consumes current, I want to stop sampling ADC data during BLE is advertising. Are there any BLE events to know when advertising happens or are there any ways, how to ignore the samples during ble transmission.

Regards,

saravana

Parents Reply
  • Hi,

    Here is a snippet showing how you can use the radio notification API:

    /*ISR triggered after protocol event end */
    
    void RADIO_NOTIFICATION_IRQHandler()
    {   
        //TODO: Perform a single SAADC sample
    }
    
    /* This function should be called right after ble_stack_init() */
    static void radio_notification_enable()
    {
        uint32_t err_code;
    
        err_code = sd_nvic_ClearPendingIRQ(RADIO_NOTIFICATION_IRQn);
        APP_ERROR_CHECK(err_code);
    
        err_code = sd_nvic_EnableIRQ(RADIO_NOTIFICATION_IRQn);
        APP_ERROR_CHECK(err_code);
    
        err_code = sd_radio_notification_cfg_set(NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE,
                                                 NRF_RADIO_NOTIFICATION_DISTANCE_NONE);
        APP_ERROR_CHECK(err_code);
    }

    Regards,

    Vidar

Children
Related