1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/samr30-xpro: add function to configure antenna switch

This commit is contained in:
Juergen Fitschen 2020-03-12 18:14:23 +01:00
parent dc89c279b2
commit 8034342c54
2 changed files with 48 additions and 0 deletions

View File

@ -28,6 +28,18 @@
void led_init(void);
void board_antenna_config(uint8_t antenna)
{
if (antenna == RFCTL_ANTENNA_EXT){
gpio_clear(RFCTL1_PIN);
gpio_set(RFCTL2_PIN);
}
else if (antenna == RFCTL_ANTENNA_BOARD){
gpio_set(RFCTL1_PIN);
gpio_clear(RFCTL2_PIN);
}
}
void board_init(void)
{
/* initialize the CPU */
@ -35,6 +47,12 @@ void board_init(void)
/* initialize the boards LEDs */
led_init();
/* initialize the on-board antenna switch */
gpio_init(RFCTL1_PIN, GPIO_OUT);
gpio_init(RFCTL2_PIN, GPIO_OUT);
/* set default antenna switch configuration */
board_antenna_config(RFCTL_ANTENNA_DEFAULT);
}

View File

@ -67,11 +67,41 @@ extern "C" {
#define BTN0_MODE GPIO_IN_PU
/** @} */
/**
* @name Antenna configuration pin interface
* @{
*/
#define RFCTL1_PIN GPIO_PIN(PA, 9)
#define RFCTL2_PIN GPIO_PIN(PA, 12)
/** @} */
/**
* @brief Antenna configuration values
*/
enum {
RFCTL_ANTENNA_BOARD,
RFCTL_ANTENNA_EXT,
};
/**
* @name Default antenna configuration
* @{
*/
#ifndef RFCTL_ANTENNA_DEFAULT
#define RFCTL_ANTENNA_DEFAULT RFCTL_ANTENNA_BOARD
#endif
/** @} */
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
/**
* @brief Set antenna switch
*/
void board_antenna_config(uint8_t antenna);
#ifdef __cplusplus
}
#endif