/* Calculate the final channel that we should advertise upon when we start an advertising event. */
static uint8_t ble_ll_adv_final_chan(struct ble_ll_adv_sm *advsm)
/* Calculate the final channel that we should advertise upon when we start an advertising event. */
static uint8_t ble_ll_adv_final_chan(struct ble_ll_adv_sm *advsm)
{
    uint8_t adv_chan;
    if (advsm->adv_chanmask & 0x04) {
        adv_chan = BLE_PHY_ADV_CHAN_START + 2;
    } else if (advsm->adv_chanmask & 0x02) {
        adv_chan = BLE_PHY_ADV_CHAN_START + 1;
    } else {
        adv_chan = BLE_PHY_ADV_CHAN_START;
    }
    return adv_chan;
}