Commit 491c3217 authored by Daniel Campora's avatar Daniel Campora
Browse files

cc3200: Re-config antenna selection when waking from suspended mode.

parent b4a41a8f
......@@ -155,8 +155,6 @@ static void bootmgr_board_init(void) {
#if MICROPY_HW_ANTENNA_DIVERSITY
// configure the antenna selection pins
antenna_init0();
// select the internal antenna
antenna_select(ANTENNA_TYPE_INTERNAL);
#endif
// Enable the Data Hashing Engine
......
......@@ -69,8 +69,6 @@ int main (void) {
#if MICROPY_HW_ANTENNA_DIVERSITY
// configure the antenna selection pins
antenna_init0();
// select the internal antenna
antenna_select(ANTENNA_TYPE_INTERNAL);
#endif
// Init the watchdog
......
......@@ -46,6 +46,11 @@ DEFINE CONSTANTS
#define REG_PAD_CONFIG_26 (0x4402E108)
#define REG_PAD_CONFIG_27 (0x4402E10C)
/******************************************************************************
DEFINE PRIVATE DATA
******************************************************************************/
static antenna_type_t antenna_type_selected = ANTENNA_TYPE_INTERNAL;
/******************************************************************************
DEFINE PUBLIC FUNCTIONS
******************************************************************************/
......@@ -76,14 +81,18 @@ void antenna_init0(void) {
// set the direction
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_27) & ~0xC00) | 0x00000800);
// select the currently active antenna
antenna_select(antenna_type_selected);
}
void antenna_select (antenna_type_t antenna_type) {
if (antenna_type == ANTENNA_TYPE_INTERNAL) {
void antenna_select (antenna_type_t _antenna) {
if (_antenna == ANTENNA_TYPE_INTERNAL) {
MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x04);
} else {
MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x08);
}
antenna_type_selected = _antenna;
}
#endif
......
......@@ -54,6 +54,7 @@
#include "mperror.h"
#include "sleeprestore.h"
#include "serverstask.h"
#include "antenna.h"
/******************************************************************************
DECLARE PRIVATE CONSTANTS
......@@ -397,6 +398,9 @@ void pybsleep_suspend_exit (void) {
// ungate the clock to the shared spi bus
MAP_PRCMPeripheralClkEnable(PRCM_SSPI, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
// re-configure the antenna selection pins
antenna_init0();
// reinitialize simplelink's interface
sl_IfOpen (NULL, 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment