particle-*: Configure antenna switch

The particle-{argon,boron,xenon} all have a uFL connector and a PCB
antenna for 2.4GHz radio, connected by a SKY13351-378LF switch
configured by a VCTL[12] pin pair.

This sets the default configuration to use the PCB antenna, as driving
an unconnected antenna will deteriorate radio performance.
This commit is contained in:
chrysn 2019-09-30 19:55:29 +02:00
parent 5105a2e54d
commit 951f7dec2c
2 changed files with 31 additions and 0 deletions

View File

@ -33,6 +33,16 @@ void board_init(void)
gpio_init(LED2_PIN, GPIO_OUT); gpio_init(LED2_PIN, GPIO_OUT);
gpio_set(LED2_PIN); gpio_set(LED2_PIN);
gpio_init(VCTL1_PIN, GPIO_OUT);
/* Suppress output to the UFL connector */
gpio_set(VCTL1_PIN);
#ifdef VCTL2_PIN
/* On boards without VCLT2_PIN (Boron), the VCTL2 net is driven by NOT(VCTL1) */
gpio_init(VCTL2_PIN, GPIO_OUT);
/* Enable output to the built-in antenna */
gpio_clear(VCTL2_PIN);
#endif
/* initialize the CPU */ /* initialize the CPU */
cpu_init(); cpu_init();
} }

View File

@ -61,6 +61,27 @@ extern "C" {
#define BTN0_MODE GPIO_IN_PU #define BTN0_MODE GPIO_IN_PU
/** @} */ /** @} */
/**
* @name Antenna selection configuration
* @{
*/
#ifdef BOARD_PARTICLE_XENON
#define VCTL1_PIN GPIO_PIN(0, 24)
#define VCTL2_PIN GPIO_PIN(0, 25)
#endif
#ifdef BOARD_PARTICLE_ARGON
#define VCTL1_PIN GPIO_PIN(0, 25)
#define VCTL2_PIN GPIO_PIN(0, 2)
#endif
#ifdef BOARD_PARTICLE_BORON
#define VCTL1_PIN GPIO_PIN(0, 7)
#endif
/** @} */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif