Skip to content

Commit da8f299

Browse files
ankunsrlubos
authored andcommitted
esb: align to mpsl_fem_tx_power_split with phy
In the MPSL the `mpsl_fem_tx_power_split` function will change soon. It will have the `phy` parameter. To smoothly transition through the change in public API for FEM the new MPSL version will define a macro `_MPSL_FEM_TX_POWER_SPLIT_HAS_PHY`. This commit aligns the ESB to the new MPSL API. For short transitional period both APIs are supprted. Signed-off-by: Andrzej Kuros <[email protected]>
1 parent ecec9d8 commit da8f299

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

subsys/esb/esb.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,13 +858,37 @@ static nrf_radio_txpower_t dbm_to_nrf_radio_txpower(int8_t tx_power)
858858
}
859859
#endif /* defined(CONFIG_SOC_SERIES_NRF54HX) || defined(CONFIG_SOC_SERIES_NRF54LX) */
860860

861+
#if defined(_MPSL_FEM_TX_POWER_SPLIT_HAS_PHY)
862+
static mpsl_phy_t convert_bitrate_to_mpsl_phy(enum esb_bitrate bitrate)
863+
{
864+
switch (bitrate) {
865+
case ESB_BITRATE_1MBPS: return MPSL_PHY_NRF_1Mbit;
866+
case ESB_BITRATE_2MBPS: return MPSL_PHY_NRF_2Mbit;
867+
#if defined(RADIO_MODE_MODE_Nrf_250Kbit)
868+
case ESB_BITRATE_250KBPS: return MPSL_PHY_NRF_250Kbit;
869+
#endif
870+
case ESB_BITRATE_1MBPS_BLE: return MPSL_PHY_BLE_1M;
871+
#if defined(RADIO_MODE_MODE_Ble_2Mbit)
872+
case ESB_BITRATE_2MBPS_BLE: return MPSL_PHY_BLE_2M;
873+
#endif
874+
#if defined(RADIO_MODE_MODE_Nrf_4Mbit_0BT6)
875+
case ESB_BITRATE_4MBPS: return MPSL_PHY_NRF_4Mbit_0BT6;
876+
#endif
877+
default: return MPSL_PHY_NRF_1Mbit;
878+
}
879+
}
880+
#endif
881+
861882
static void update_radio_tx_power(void)
862883
{
863884
#if !(defined(CONFIG_SOC_SERIES_NRF54HX) || defined(CONFIG_SOC_SERIES_NRF54LX))
864885
int32_t err;
865886
mpsl_tx_power_split_t tx_power;
866887

867888
(void)mpsl_fem_tx_power_split(esb_cfg.tx_output_power, &tx_power,
889+
#if defined(_MPSL_FEM_TX_POWER_SPLIT_HAS_PHY)
890+
convert_bitrate_to_mpsl_phy(esb_cfg.bitrate),
891+
#endif
868892
(RADIO_BASE_FREQUENCY + esb_addr.rf_channel), false);
869893

870894
err = mpsl_fem_pa_power_control_set(tx_power.fem_pa_power_control);

0 commit comments

Comments
 (0)