Skip to content

Commit

Permalink
Allow higher TX power for nRF devices when supported.
Browse files Browse the repository at this point in the history
  • Loading branch information
h2zero committed Feb 25, 2024
1 parent da13d86 commit aa37fad
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/nimble/nimble/drivers/nrf52/src/ble_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1977,9 +1977,31 @@ ble_phy_txpwr_set(int dbm)
*/
int ble_phy_txpower_round(int dbm)
{
/* TODO this should be per nRF52XXX */

/* "Rail" power level if outside supported range */
#ifdef RADIO_TXPOWER_TXPOWER_Pos8dBm
if (dbm >= (int8_t)RADIO_TXPOWER_TXPOWER_Pos8dBm) {
return (int8_t)RADIO_TXPOWER_TXPOWER_Pos8dBm;
}
#endif

#ifdef RADIO_TXPOWER_TXPOWER_Pos7dBm
if (dbm >= (int8_t)RADIO_TXPOWER_TXPOWER_Pos7dBm) {
return (int8_t)RADIO_TXPOWER_TXPOWER_Pos7dBm;
}
#endif

#ifdef RADIO_TXPOWER_TXPOWER_Pos6dBm
if (dbm >= (int8_t)RADIO_TXPOWER_TXPOWER_Pos6dBm) {
return (int8_t)RADIO_TXPOWER_TXPOWER_Pos6dBm;
}
#endif

#ifdef RADIO_TXPOWER_TXPOWER_Pos5dBm
if (dbm >= (int8_t)RADIO_TXPOWER_TXPOWER_Pos5dBm) {
return (int8_t)RADIO_TXPOWER_TXPOWER_Pos5dBm;
}
#endif

if (dbm >= (int8_t)RADIO_TXPOWER_TXPOWER_Pos4dBm) {
return (int8_t)RADIO_TXPOWER_TXPOWER_Pos4dBm;
}
Expand Down

0 comments on commit aa37fad

Please sign in to comment.