Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLE: NRF52 returns used tx/rx phy on phy update callback #9220

Merged
merged 1 commit into from
Jan 3, 2019

Conversation

desmond-blue
Copy link
Contributor

Description

The on phy upate callback function of NRF52, which is nRF5xGap::on_phy_update(), doesn't respect to used tx/rx phy, the parameters are hard-coded to LE_1M.

Those parameters should be set according to event from btle_handler()

Pull request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@desmond-blue desmond-blue changed the title NRF52 returns used tx/rx phy on phy update callback BLE: NRF52 returns used tx/rx phy on phy update callback Jan 2, 2019
@ciarmcom ciarmcom requested a review from a team January 2, 2019 08:00
@ciarmcom
Copy link
Member

ciarmcom commented Jan 2, 2019

@desmond-blue, thank you for your changes.
@ARMmbed/mbed-os-pan @ARMmbed/mbed-os-maintainers please review.

@ciarmcom ciarmcom requested a review from a team January 2, 2019 08:00
pan-
pan- previously requested changes Jan 2, 2019
Copy link
Member

@pan- pan- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the submission, could you add a conversion function that maps phy values from the nordic domain to the mbed domain ? There is already few conversion functions in the anonymous namespace at the top of the file.

ble::phy_t convert_phy(uint8_t nordic_phy)
{ 
    switch(evt.rx_phy) {
        case BLE_GAP_PHY_1MBPS:
            return ble::phy_t::LE_1M;

        case BLE_GAP_PHY_2MBPS:
            return ble::phy_t::LE_2M;

        case BLE_GAP_PHY_CODED:
            return ble::phy_t::LE_CODED;

        default:
            return ble::phy_t::NONE;
    }
}

// in on_phy_update

    _eventHandler->onPhyUpdateComplete(
        status,
        connection,
        convert_phy(evt.tx_phy),
        convert_phy(evt.rx_phy)
    );

@desmond-blue
Copy link
Contributor Author

Thanks for the reviewing, I change the code accordingly.

@cmonr cmonr dismissed pan-’s stale review January 3, 2019 02:54

Please re-review. Changes applied.

Copy link
Contributor

@cmonr cmonr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 3, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 3, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@cmonr cmonr merged commit e66e616 into ARMmbed:master Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants