Skip to content

Commit f281e06

Browse files
committed
BLE: NRF52 returns tx/rx phy on phy update callback
1 parent 51143ea commit f281e06

File tree

1 file changed

+19
-2
lines changed
  • features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NORDIC_SOFTDEVICE/TARGET_NRF52/source

1 file changed

+19
-2
lines changed

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NORDIC_SOFTDEVICE/TARGET_NRF52/source/nRF5xGap.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,23 @@ peer_address_type_t convert_identity_address(advertising_peer_address_type_t add
115115
}
116116
}
117117

118+
ble::phy_t convert_phy(uint8_t nordic_phy)
119+
{
120+
switch(nordic_phy) {
121+
case BLE_GAP_PHY_1MBPS:
122+
return ble::phy_t::LE_1M;
123+
124+
case BLE_GAP_PHY_2MBPS:
125+
return ble::phy_t::LE_2M;
126+
127+
case BLE_GAP_PHY_CODED:
128+
return ble::phy_t::LE_CODED;
129+
130+
default:
131+
return ble::phy_t::NONE;
132+
}
133+
}
134+
118135
// FIXME: update when SD 5 (not alpha!) or more is used for 52840.
119136
#ifndef BLE_GAP_PHY_AUTO
120137
#define BLE_GAP_PHY_AUTO 0
@@ -1630,8 +1647,8 @@ void nRF5xGap::on_phy_update(
16301647
_eventHandler->onPhyUpdateComplete(
16311648
status,
16321649
connection,
1633-
Phy_t::LE_1M,
1634-
Phy_t::LE_1M
1650+
convert_phy(evt.tx_phy),
1651+
convert_phy(evt.rx_phy)
16351652
);
16361653
}
16371654

0 commit comments

Comments
 (0)