File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,8 +155,6 @@ static void bootmgr_board_init(void) {
155155#if MICROPY_HW_ANTENNA_DIVERSITY
156156 // configure the antenna selection pins
157157 antenna_init0 ();
158- // select the internal antenna
159- antenna_select (ANTENNA_TYPE_INTERNAL );
160158#endif
161159
162160 // Enable the Data Hashing Engine
Original file line number Diff line number Diff line change @@ -69,8 +69,6 @@ int main (void) {
6969#if MICROPY_HW_ANTENNA_DIVERSITY
7070 // configure the antenna selection pins
7171 antenna_init0 ();
72- // select the internal antenna
73- antenna_select (ANTENNA_TYPE_INTERNAL );
7472#endif
7573
7674 // Init the watchdog
Original file line number Diff line number Diff line change @@ -46,6 +46,11 @@ DEFINE CONSTANTS
4646#define REG_PAD_CONFIG_26 (0x4402E108)
4747#define REG_PAD_CONFIG_27 (0x4402E10C)
4848
49+ /******************************************************************************
50+ DEFINE PRIVATE DATA
51+ ******************************************************************************/
52+ static antenna_type_t antenna_type_selected = ANTENNA_TYPE_INTERNAL ;
53+
4954/******************************************************************************
5055DEFINE PUBLIC FUNCTIONS
5156******************************************************************************/
@@ -76,14 +81,18 @@ void antenna_init0(void) {
7681
7782 // set the direction
7883 HWREG (REG_PAD_CONFIG_26 ) = ((HWREG (REG_PAD_CONFIG_27 ) & ~0xC00 ) | 0x00000800 );
84+
85+ // select the currently active antenna
86+ antenna_select (antenna_type_selected );
7987}
8088
81- void antenna_select (antenna_type_t antenna_type ) {
82- if (antenna_type == ANTENNA_TYPE_INTERNAL ) {
89+ void antenna_select (antenna_type_t _antenna ) {
90+ if (_antenna == ANTENNA_TYPE_INTERNAL ) {
8391 MAP_GPIOPinWrite (GPIOA3_BASE , 0x0C , 0x04 );
8492 } else {
8593 MAP_GPIOPinWrite (GPIOA3_BASE , 0x0C , 0x08 );
8694 }
95+ antenna_type_selected = _antenna ;
8796}
8897
8998#endif
Original file line number Diff line number Diff line change 5454#include "mperror.h"
5555#include "sleeprestore.h"
5656#include "serverstask.h"
57+ #include "antenna.h"
5758
5859/******************************************************************************
5960 DECLARE PRIVATE CONSTANTS
@@ -397,6 +398,9 @@ void pybsleep_suspend_exit (void) {
397398 // ungate the clock to the shared spi bus
398399 MAP_PRCMPeripheralClkEnable (PRCM_SSPI , PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK );
399400
401+ // re-configure the antenna selection pins
402+ antenna_init0 ();
403+
400404 // reinitialize simplelink's interface
401405 sl_IfOpen (NULL , 0 );
402406
You can’t perform that action at this time.
0 commit comments