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 <ayush@beagleboard.org>
This commit is contained in:
parent
894e7bdbdc
commit
35391f3d34
1 changed files with 12 additions and 20 deletions
|
@ -30,39 +30,31 @@
|
||||||
#define BOARD_ANT_GPIO_PA 1
|
#define BOARD_ANT_GPIO_PA 1
|
||||||
#define BOARD_ANT_GPIO_SUBG 2
|
#define BOARD_ANT_GPIO_SUBG 2
|
||||||
|
|
||||||
#define ANTENNA_MUX DT_NODELABEL(antenna_mux0)
|
|
||||||
|
|
||||||
static int board_antenna_init(const struct device *dev);
|
static int board_antenna_init(const struct device *dev);
|
||||||
static void board_cc13xx_rf_callback(RF_Handle client, RF_GlobalEvent events,
|
static void board_cc13xx_rf_callback(RF_Handle client, RF_GlobalEvent events, void *arg);
|
||||||
void *arg);
|
|
||||||
|
|
||||||
const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
|
const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
|
||||||
.hwiPriority = INT_PRI_LEVEL7,
|
.hwiPriority = INT_PRI_LEVEL7,
|
||||||
.swiPriority = 0,
|
.swiPriority = 0,
|
||||||
.xoscHfAlwaysNeeded = true,
|
.xoscHfAlwaysNeeded = true,
|
||||||
/* RF driver callback for custom antenna switching */
|
/* RF driver callback for custom antenna switching */
|
||||||
.globalCallback = board_cc13xx_rf_callback,
|
.globalCallback = board_cc13xx_rf_callback,
|
||||||
/* Subscribe to events */
|
/* Subscribe to events */
|
||||||
.globalEventMask = (RF_GlobalEventRadioSetup |
|
.globalEventMask = (RF_GlobalEventRadioSetup | RF_GlobalEventRadioPowerDown),
|
||||||
RF_GlobalEventRadioPowerDown),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PINCTRL_DT_INST_DEFINE(0);
|
PINCTRL_DT_INST_DEFINE(0);
|
||||||
DEVICE_DT_INST_DEFINE(0, board_antenna_init, NULL, NULL, NULL,
|
DEVICE_DT_INST_DEFINE(0, board_antenna_init, NULL, NULL, NULL, POST_KERNEL,
|
||||||
POST_KERNEL, CONFIG_BOARD_ANTENNA_INIT_PRIO, NULL);
|
CONFIG_BOARD_ANTENNA_INIT_PRIO, NULL);
|
||||||
|
|
||||||
static const struct pinctrl_dev_config *ant_pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0);
|
static const struct pinctrl_dev_config *ant_pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0);
|
||||||
static const struct gpio_dt_spec ant_gpios[] = {
|
static const struct gpio_dt_spec ant_gpios[] = {
|
||||||
GPIO_DT_SPEC_GET_BY_IDX_OR(ANTENNA_MUX, gpios, BOARD_ANT_GPIO_24G, {0}),
|
DT_FOREACH_PROP_ELEM_SEP(DT_NODELABEL(antenna_mux0), gpios, GPIO_DT_SPEC_GET_BY_IDX, (,))};
|
||||||
GPIO_DT_SPEC_GET_BY_IDX_OR(ANTENNA_MUX, gpios, BOARD_ANT_GPIO_PA, {0}),
|
|
||||||
GPIO_DT_SPEC_GET_BY_IDX_OR(ANTENNA_MUX, gpios, BOARD_ANT_GPIO_SUBG, {0}),
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Antenna switch GPIO init routine.
|
* Antenna switch GPIO init routine.
|
||||||
*/
|
*/
|
||||||
int board_antenna_init(const struct device *dev)
|
static int board_antenna_init(const struct device *dev)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(dev);
|
ARG_UNUSED(dev);
|
||||||
int i;
|
int i;
|
||||||
|
@ -79,9 +71,9 @@ int board_antenna_init(const struct device *dev)
|
||||||
/**
|
/**
|
||||||
* Custom TI RFCC26XX callback for switching the on-board antenna mux on radio setup.
|
* Custom TI RFCC26XX callback for switching the on-board antenna mux on radio setup.
|
||||||
*/
|
*/
|
||||||
void board_cc13xx_rf_callback(RF_Handle client, RF_GlobalEvent events, void *arg)
|
static void board_cc13xx_rf_callback(RF_Handle client, RF_GlobalEvent events, void *arg)
|
||||||
{
|
{
|
||||||
bool sub1GHz = false;
|
bool sub1GHz = false;
|
||||||
uint8_t loDivider = 0;
|
uint8_t loDivider = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -92,8 +84,8 @@ void board_cc13xx_rf_callback(RF_Handle client, RF_GlobalEvent events, void *arg
|
||||||
|
|
||||||
if (events & RF_GlobalEventRadioSetup) {
|
if (events & RF_GlobalEventRadioSetup) {
|
||||||
/* Decode the current PA configuration. */
|
/* Decode the current PA configuration. */
|
||||||
RF_TxPowerTable_PAType paType = (RF_TxPowerTable_PAType)
|
RF_TxPowerTable_PAType paType =
|
||||||
RF_getTxPower(client).paType;
|
(RF_TxPowerTable_PAType)RF_getTxPower(client).paType;
|
||||||
/* Decode the generic argument as a setup command. */
|
/* Decode the generic argument as a setup command. */
|
||||||
RF_RadioSetup *setupCommand = (RF_RadioSetup *)arg;
|
RF_RadioSetup *setupCommand = (RF_RadioSetup *)arg;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue