summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--cc3200/bootmgr/main.c2
-rw-r--r--cc3200/main.c2
-rw-r--r--cc3200/misc/antenna.c13
-rw-r--r--cc3200/mods/pybsleep.c4
4 files changed, 15 insertions, 6 deletions
diff --git a/cc3200/bootmgr/main.c b/cc3200/bootmgr/main.c
index 6c8be9a0c7..e799fcf1d6 100644
--- a/cc3200/bootmgr/main.c
+++ b/cc3200/bootmgr/main.c
@@ -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
diff --git a/cc3200/main.c b/cc3200/main.c
index 6856cbfaf0..b217e20a14 100644
--- a/cc3200/main.c
+++ b/cc3200/main.c
@@ -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
diff --git a/cc3200/misc/antenna.c b/cc3200/misc/antenna.c
index 28ef526fee..5c7f3053e7 100644
--- a/cc3200/misc/antenna.c
+++ b/cc3200/misc/antenna.c
@@ -47,6 +47,11 @@ DEFINE CONSTANTS
#define REG_PAD_CONFIG_27 (0x4402E10C)
/******************************************************************************
+DEFINE PRIVATE DATA
+******************************************************************************/
+static antenna_type_t antenna_type_selected = ANTENNA_TYPE_INTERNAL;
+
+/******************************************************************************
DEFINE PUBLIC FUNCTIONS
******************************************************************************/
void antenna_init0(void) {
@@ -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
diff --git a/cc3200/mods/pybsleep.c b/cc3200/mods/pybsleep.c
index a84c6aefd6..9b239bb713 100644
--- a/cc3200/mods/pybsleep.c
+++ b/cc3200/mods/pybsleep.c
@@ -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);