1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 05:53:49 +01:00

nrf802154: don't hard-code max TX power

The smaller family members only have 4dBm max output power.
This commit is contained in:
Benjamin Valentin 2020-11-05 20:54:23 +01:00
parent f23c616eb1
commit fea9e68b88
2 changed files with 6 additions and 6 deletions

View File

@ -193,8 +193,8 @@ static int16_t _get_txpower(void)
static void _set_txpower(int16_t txpower)
{
if (txpower > 8) {
NRF_RADIO->TXPOWER = RADIO_TXPOWER_TXPOWER_Pos8dBm;
if (txpower > (int)RADIO_TXPOWER_TXPOWER_Max) {
NRF_RADIO->TXPOWER = RADIO_TXPOWER_TXPOWER_Max;
}
else if (txpower > 1) {
NRF_RADIO->TXPOWER = (uint32_t)txpower;

View File

@ -38,8 +38,8 @@
/* Set timer period to 16 us (IEEE 802.15.4 symbol time) */
#define TIMER_FREQ (62500UL)
#define TX_POWER_MIN (-40) /* in dBm */
#define TX_POWER_MAX (8) /* in dBm */
#define TX_POWER_MIN (-40) /* in dBm */
#define TX_POWER_MAX ((int)RADIO_TXPOWER_TXPOWER_Max) /* in dBm */
/**
* @brief Default nrf802154 radio shortcuts
@ -308,8 +308,8 @@ static int set_cca_threshold(ieee802154_dev_t *dev, int8_t threshold)
static void _set_txpower(int16_t txpower)
{
DEBUG("[nrf802154]: Setting TX power to %i\n", txpower);
if (txpower > 8) {
NRF_RADIO->TXPOWER = RADIO_TXPOWER_TXPOWER_Pos8dBm;
if (txpower > (int)RADIO_TXPOWER_TXPOWER_Max) {
NRF_RADIO->TXPOWER = RADIO_TXPOWER_TXPOWER_Max;
}
else if (txpower > 1) {
NRF_RADIO->TXPOWER = (uint32_t)txpower;