Bluetooth: controller: Add Tx Power Kconfig option
Add support for changing the default Tx Power value using Kconfig option. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
3f3a907bb8
commit
dc95e1ba05
|
@ -108,6 +108,67 @@ config BT_CTLR_TX_BUFFER_SIZE
|
|||
Maximum is set to 16384 due to implementation limitations (use of
|
||||
u16_t for size/length variables).
|
||||
|
||||
choice
|
||||
prompt "Tx Power"
|
||||
default BT_CTLR_TX_PWR_0
|
||||
help
|
||||
Select the supported BLE Radio transmit power level in dBm.
|
||||
|
||||
config BT_CTLR_TX_PWR_PLUS_8
|
||||
bool "+8 dBm"
|
||||
depends on SOC_NRF52840
|
||||
|
||||
config BT_CTLR_TX_PWR_PLUS_7
|
||||
bool "+7 dBm"
|
||||
depends on SOC_NRF52840
|
||||
|
||||
config BT_CTLR_TX_PWR_PLUS_6
|
||||
bool "+6 dBm"
|
||||
depends on SOC_NRF52840
|
||||
|
||||
config BT_CTLR_TX_PWR_PLUS_5
|
||||
bool "+5 dBm"
|
||||
depends on SOC_NRF52840
|
||||
|
||||
config BT_CTLR_TX_PWR_PLUS_4
|
||||
bool "+4 dBm"
|
||||
|
||||
config BT_CTLR_TX_PWR_PLUS_3
|
||||
bool "+3 dBm"
|
||||
depends on SOC_SERIES_NRF52X
|
||||
|
||||
config BT_CTLR_TX_PWR_PLUS_2
|
||||
bool "+2 dBm"
|
||||
depends on SOC_NRF52840
|
||||
|
||||
config BT_CTLR_TX_PWR_0
|
||||
bool "0 dBm"
|
||||
|
||||
config BT_CTLR_TX_PWR_MINUS_4
|
||||
bool "-4 dBm"
|
||||
|
||||
config BT_CTLR_TX_PWR_MINUS_8
|
||||
bool "-8 dBm"
|
||||
|
||||
config BT_CTLR_TX_PWR_MINUS_12
|
||||
bool "-12 dBm"
|
||||
|
||||
config BT_CTLR_TX_PWR_MINUS_16
|
||||
bool "-16 dBm"
|
||||
|
||||
config BT_CTLR_TX_PWR_MINUS_20
|
||||
bool "-20 dBm"
|
||||
|
||||
config BT_CTLR_TX_PWR_MINUS_30
|
||||
bool "-30 dBm"
|
||||
depends on SOC_SERIES_NRF51X
|
||||
|
||||
config BT_CTLR_TX_PWR_MINUS_40
|
||||
bool "-40 dBm"
|
||||
depends on SOC_SERIES_NRF52X
|
||||
|
||||
endchoice
|
||||
|
||||
config BT_CTLR_COMPANY_ID
|
||||
prompt "Company Id"
|
||||
hex
|
||||
|
|
|
@ -108,7 +108,7 @@ void radio_phy_set(u8_t phy, u8_t flags)
|
|||
|
||||
void radio_tx_power_set(u32_t power)
|
||||
{
|
||||
/* TODO map power to h/w values. */
|
||||
/* NOTE: valid value range is passed by Kconfig define. */
|
||||
NRF_RADIO->TXPOWER = power;
|
||||
}
|
||||
|
||||
|
|
37
subsys/bluetooth/controller/hal/nrf5/radio/radio_nrf5_txp.h
Normal file
37
subsys/bluetooth/controller/hal/nrf5/radio/radio_nrf5_txp.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_TX_PWR_PLUS_8)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos8dBm
|
||||
#elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_7)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos7dBm
|
||||
#elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_6)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos6dBm
|
||||
#elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_5)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos5dBm
|
||||
#elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_4)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos4dBm
|
||||
#elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_3)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos3dBm
|
||||
#elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_2)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos2dBm
|
||||
#elif defined(CONFIG_BT_CTLR_TX_PWR_0)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_0dBm
|
||||
#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_4)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg4dBm
|
||||
#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_8)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg8dBm
|
||||
#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_12)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg12dBm
|
||||
#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_16)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg16dBm
|
||||
#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_20)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg20dBm
|
||||
#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_30)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg30dBm
|
||||
#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_40)
|
||||
#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg40dBm
|
||||
#endif
|
9
subsys/bluetooth/controller/hal/radio_txp.h
Normal file
9
subsys/bluetooth/controller/hal/radio_txp.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_SOC_FAMILY_NRF)
|
||||
#include "nrf5/radio/radio_nrf5_txp.h"
|
||||
#endif
|
|
@ -25,6 +25,7 @@
|
|||
#include "hal/ecb.h"
|
||||
#include "hal/ccm.h"
|
||||
#include "hal/radio.h"
|
||||
#include "hal/radio_txp.h"
|
||||
#include "hal/ticker.h"
|
||||
#include "hal/debug.h"
|
||||
|
||||
|
@ -5879,7 +5880,7 @@ again:
|
|||
static void adv_scan_conn_configure(void)
|
||||
{
|
||||
radio_reset();
|
||||
radio_tx_power_set(0);
|
||||
radio_tx_power_set(RADIO_TXP_DEFAULT);
|
||||
radio_isr_set(isr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue