Skip to content

Commit 95f73c3

Browse files
committed
boards: ti: cc1352p1_launchxl: Refactor for beagleconnect_freedom
- Minimize diff between beagle/beagleconnect_freedom/board_antenna.c - Make functions static - Minor formatting - Remove unused ANTENNA_MUX - Use DT_FOREACH_PROP_ELEM_SEP for GPIO array Signed-off-by: Ayush Singh <[email protected]>
1 parent 0558a1d commit 95f73c3

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

boards/ti/cc1352p1_launchxl/board_antenna.c

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,31 @@
3030
#define BOARD_ANT_GPIO_PA 1
3131
#define BOARD_ANT_GPIO_SUBG 2
3232

33-
#define ANTENNA_MUX DT_NODELABEL(antenna_mux0)
34-
3533
static int board_antenna_init(const struct device *dev);
36-
static void board_cc13xx_rf_callback(RF_Handle client, RF_GlobalEvent events,
37-
void *arg);
34+
static void board_cc13xx_rf_callback(RF_Handle client, RF_GlobalEvent events, void *arg);
3835

3936
const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
40-
.hwiPriority = INT_PRI_LEVEL7,
41-
.swiPriority = 0,
37+
.hwiPriority = INT_PRI_LEVEL7,
38+
.swiPriority = 0,
4239
.xoscHfAlwaysNeeded = true,
4340
/* RF driver callback for custom antenna switching */
4441
.globalCallback = board_cc13xx_rf_callback,
4542
/* Subscribe to events */
46-
.globalEventMask = (RF_GlobalEventRadioSetup |
47-
RF_GlobalEventRadioPowerDown),
43+
.globalEventMask = (RF_GlobalEventRadioSetup | RF_GlobalEventRadioPowerDown),
4844
};
4945

5046
PINCTRL_DT_INST_DEFINE(0);
51-
DEVICE_DT_INST_DEFINE(0, board_antenna_init, NULL, NULL, NULL,
52-
POST_KERNEL, CONFIG_BOARD_ANTENNA_INIT_PRIO, NULL);
47+
DEVICE_DT_INST_DEFINE(0, board_antenna_init, NULL, NULL, NULL, POST_KERNEL,
48+
CONFIG_BOARD_ANTENNA_INIT_PRIO, NULL);
5349

5450
static const struct pinctrl_dev_config *ant_pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0);
5551
static const struct gpio_dt_spec ant_gpios[] = {
56-
GPIO_DT_SPEC_GET_BY_IDX_OR(ANTENNA_MUX, gpios, BOARD_ANT_GPIO_24G, {0}),
57-
GPIO_DT_SPEC_GET_BY_IDX_OR(ANTENNA_MUX, gpios, BOARD_ANT_GPIO_PA, {0}),
58-
GPIO_DT_SPEC_GET_BY_IDX_OR(ANTENNA_MUX, gpios, BOARD_ANT_GPIO_SUBG, {0}),
59-
};
60-
52+
DT_FOREACH_PROP_ELEM_SEP(DT_NODELABEL(antenna_mux0), gpios, GPIO_DT_SPEC_GET_BY_IDX, (,))};
6153

6254
/**
6355
* Antenna switch GPIO init routine.
6456
*/
65-
int board_antenna_init(const struct device *dev)
57+
static int board_antenna_init(const struct device *dev)
6658
{
6759
ARG_UNUSED(dev);
6860
int i;
@@ -79,9 +71,9 @@ int board_antenna_init(const struct device *dev)
7971
/**
8072
* Custom TI RFCC26XX callback for switching the on-board antenna mux on radio setup.
8173
*/
82-
void board_cc13xx_rf_callback(RF_Handle client, RF_GlobalEvent events, void *arg)
74+
static void board_cc13xx_rf_callback(RF_Handle client, RF_GlobalEvent events, void *arg)
8375
{
84-
bool sub1GHz = false;
76+
bool sub1GHz = false;
8577
uint8_t loDivider = 0;
8678
int i;
8779

@@ -92,8 +84,8 @@ void board_cc13xx_rf_callback(RF_Handle client, RF_GlobalEvent events, void *arg
9284

9385
if (events & RF_GlobalEventRadioSetup) {
9486
/* Decode the current PA configuration. */
95-
RF_TxPowerTable_PAType paType = (RF_TxPowerTable_PAType)
96-
RF_getTxPower(client).paType;
87+
RF_TxPowerTable_PAType paType =
88+
(RF_TxPowerTable_PAType)RF_getTxPower(client).paType;
9789
/* Decode the generic argument as a setup command. */
9890
RF_RadioSetup *setupCommand = (RF_RadioSetup *)arg;
9991

0 commit comments

Comments
 (0)