diff options
author | Damien George <damien.p.george@gmail.com> | 2014-05-03 17:32:55 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-05-03 17:32:55 +0100 |
commit | ae8feac598980d965c3eca9ab4f2903e51f955a5 (patch) | |
tree | 3d5cddc45a57dc33947a886961880d0a0e3a96db | |
parent | 9c5fc83e6ab39abaf8e3c803c7f13cda33a50280 (diff) | |
download | micropython-ae8feac598980d965c3eca9ab4f2903e51f955a5.tar.gz micropython-ae8feac598980d965c3eca9ab4f2903e51f955a5.zip |
stmhal: Wrap CC3000 driver in MICROPY_HW_ENABLE_CC3K.
This renames MICROPY_HW_HAS_WLAN to MICROPY_HW_ENABLE_CC3K (since it's a
driver, not a board feature) and wraps all CC3000 code in this #if.
It's disabled for all boards.
-rw-r--r-- | stmhal/boards/NETDUINO_PLUS_2/mpconfigboard.h | 2 | ||||
-rw-r--r-- | stmhal/boards/PYBV10/mpconfigboard.h | 2 | ||||
-rw-r--r-- | stmhal/boards/PYBV3/mpconfigboard.h | 2 | ||||
-rw-r--r-- | stmhal/boards/PYBV4/mpconfigboard.h | 2 | ||||
-rw-r--r-- | stmhal/boards/STM32F4DISC/mpconfigboard.h | 2 | ||||
-rw-r--r-- | stmhal/cc3k/cc3000_common.c | 5 | ||||
-rw-r--r-- | stmhal/cc3k/ccspi.c | 5 | ||||
-rw-r--r-- | stmhal/cc3k/evnt_handler.c | 5 | ||||
-rw-r--r-- | stmhal/cc3k/hci.c | 5 | ||||
-rw-r--r-- | stmhal/cc3k/netapp.c | 5 | ||||
-rw-r--r-- | stmhal/cc3k/nvmem.c | 4 | ||||
-rw-r--r-- | stmhal/cc3k/pybcc3k.c | 4 | ||||
-rw-r--r-- | stmhal/cc3k/security.c | 5 | ||||
-rw-r--r-- | stmhal/cc3k/socket.c | 5 | ||||
-rw-r--r-- | stmhal/cc3k/wlan.c | 5 | ||||
-rw-r--r-- | stmhal/main.c | 6 | ||||
-rw-r--r-- | stmhal/pybwlan.c | 4 |
17 files changed, 59 insertions, 9 deletions
diff --git a/stmhal/boards/NETDUINO_PLUS_2/mpconfigboard.h b/stmhal/boards/NETDUINO_PLUS_2/mpconfigboard.h index b70b56d9ce..0e40545253 100644 --- a/stmhal/boards/NETDUINO_PLUS_2/mpconfigboard.h +++ b/stmhal/boards/NETDUINO_PLUS_2/mpconfigboard.h @@ -11,7 +11,6 @@ #define MICROPY_HW_HAS_MMA7660 (0) #define MICROPY_HW_HAS_LIS3DSH (0) #define MICROPY_HW_HAS_LCD (0) -#define MICROPY_HW_HAS_WLAN (0) #define MICROPY_HW_ENABLE_RNG (1) #define MICROPY_HW_ENABLE_RTC (0) #define MICROPY_HW_ENABLE_TIMER (1) @@ -20,6 +19,7 @@ #define MICROPY_HW_ENABLE_I2C1 (0) #define MICROPY_HW_ENABLE_SPI1 (0) #define MICROPY_HW_ENABLE_SPI3 (0) +#define MICROPY_HW_ENABLE_CC3K (0) // USRSW is pulled low. Pressing the button makes the input go high. #define MICROPY_HW_USRSW_PIN (pin_B11) diff --git a/stmhal/boards/PYBV10/mpconfigboard.h b/stmhal/boards/PYBV10/mpconfigboard.h index fc22f63341..3def531232 100644 --- a/stmhal/boards/PYBV10/mpconfigboard.h +++ b/stmhal/boards/PYBV10/mpconfigboard.h @@ -7,7 +7,6 @@ #define MICROPY_HW_HAS_MMA7660 (1) #define MICROPY_HW_HAS_LIS3DSH (0) #define MICROPY_HW_HAS_LCD (1) -#define MICROPY_HW_HAS_WLAN (1) #define MICROPY_HW_ENABLE_RNG (1) #define MICROPY_HW_ENABLE_RTC (1) #define MICROPY_HW_ENABLE_TIMER (1) @@ -16,6 +15,7 @@ #define MICROPY_HW_ENABLE_I2C1 (1) #define MICROPY_HW_ENABLE_SPI1 (1) #define MICROPY_HW_ENABLE_SPI3 (0) +#define MICROPY_HW_ENABLE_CC3K (0) // USRSW has no pullup or pulldown, and pressing the switch makes the input go low #define MICROPY_HW_USRSW_PIN (pin_B3) diff --git a/stmhal/boards/PYBV3/mpconfigboard.h b/stmhal/boards/PYBV3/mpconfigboard.h index af4da0c1d6..ac0d84ca29 100644 --- a/stmhal/boards/PYBV3/mpconfigboard.h +++ b/stmhal/boards/PYBV3/mpconfigboard.h @@ -7,7 +7,6 @@ #define MICROPY_HW_HAS_MMA7660 (1) #define MICROPY_HW_HAS_LIS3DSH (0) #define MICROPY_HW_HAS_LCD (0) -#define MICROPY_HW_HAS_WLAN (0) #define MICROPY_HW_ENABLE_RNG (1) #define MICROPY_HW_ENABLE_RTC (1) #define MICROPY_HW_ENABLE_TIMER (1) @@ -16,6 +15,7 @@ #define MICROPY_HW_ENABLE_I2C1 (1) #define MICROPY_HW_ENABLE_SPI1 (1) #define MICROPY_HW_ENABLE_SPI3 (0) +#define MICROPY_HW_ENABLE_CC3K (0) // USRSW has no pullup or pulldown, and pressing the switch makes the input go low #define MICROPY_HW_USRSW_PIN (pin_A13) diff --git a/stmhal/boards/PYBV4/mpconfigboard.h b/stmhal/boards/PYBV4/mpconfigboard.h index 550f1633f9..9fedb70136 100644 --- a/stmhal/boards/PYBV4/mpconfigboard.h +++ b/stmhal/boards/PYBV4/mpconfigboard.h @@ -7,7 +7,6 @@ #define MICROPY_HW_HAS_MMA7660 (1) #define MICROPY_HW_HAS_LIS3DSH (0) #define MICROPY_HW_HAS_LCD (1) -#define MICROPY_HW_HAS_WLAN (0) #define MICROPY_HW_ENABLE_RNG (1) #define MICROPY_HW_ENABLE_RTC (1) #define MICROPY_HW_ENABLE_TIMER (1) @@ -16,6 +15,7 @@ #define MICROPY_HW_ENABLE_I2C1 (1) #define MICROPY_HW_ENABLE_SPI1 (1) #define MICROPY_HW_ENABLE_SPI3 (0) +#define MICROPY_HW_ENABLE_CC3K (0) // USRSW has no pullup or pulldown, and pressing the switch makes the input go low #define MICROPY_HW_USRSW_PIN (pin_B3) diff --git a/stmhal/boards/STM32F4DISC/mpconfigboard.h b/stmhal/boards/STM32F4DISC/mpconfigboard.h index c83bb162bb..e6780eacbd 100644 --- a/stmhal/boards/STM32F4DISC/mpconfigboard.h +++ b/stmhal/boards/STM32F4DISC/mpconfigboard.h @@ -7,7 +7,6 @@ #define MICROPY_HW_HAS_MMA7660 (0) #define MICROPY_HW_HAS_LIS3DSH (1) #define MICROPY_HW_HAS_LCD (0) -#define MICROPY_HW_HAS_WLAN (0) #define MICROPY_HW_ENABLE_RNG (1) #define MICROPY_HW_ENABLE_RTC (1) #define MICROPY_HW_ENABLE_TIMER (1) @@ -16,6 +15,7 @@ #define MICROPY_HW_ENABLE_I2C1 (1) #define MICROPY_HW_ENABLE_SPI1 (1) #define MICROPY_HW_ENABLE_SPI3 (0) +#define MICROPY_HW_ENABLE_CC3K (0) // USRSW is pulled low. Pressing the button makes the input go high. #define MICROPY_HW_USRSW_PIN (pin_A0) diff --git a/stmhal/cc3k/cc3000_common.c b/stmhal/cc3k/cc3000_common.c index 48eda26760..8d9bd7d03a 100644 --- a/stmhal/cc3k/cc3000_common.c +++ b/stmhal/cc3k/cc3000_common.c @@ -52,6 +52,9 @@ * *****************************************************************************/ #include <stdint.h> +#include "mpconfigport.h" + +#if MICROPY_HW_ENABLE_CC3K #include "cc3000_common.h" #include "socket.h" @@ -194,3 +197,5 @@ uint32_t STREAM_TO_UINT32_f(char * cp, uint16_t offset) //! @} // //***************************************************************************** + +#endif // MICROPY_HW_ENABLE_CC3K diff --git a/stmhal/cc3k/ccspi.c b/stmhal/cc3k/ccspi.c index 4785897e13..133b17d030 100644 --- a/stmhal/cc3k/ccspi.c +++ b/stmhal/cc3k/ccspi.c @@ -42,6 +42,9 @@ *****************************************************************************/ #include <stdint.h> #include <string.h> // for memset +#include "mpconfigport.h" + +#if MICROPY_HW_ENABLE_CC3K #include "ccspi.h" #include "hci.h" @@ -735,3 +738,5 @@ void cc3k_int_poll() SpiIntGPIOHandler(); } } + +#endif // MICROPY_HW_ENABLE_CC3K diff --git a/stmhal/cc3k/evnt_handler.c b/stmhal/cc3k/evnt_handler.c index 5a75fadcc0..cca2e796d7 100644 --- a/stmhal/cc3k/evnt_handler.c +++ b/stmhal/cc3k/evnt_handler.c @@ -52,6 +52,9 @@ //****************************************************************************** #include <stdint.h> +#include "mpconfigport.h" + +#if MICROPY_HW_ENABLE_CC3K #include "cc3000_common.h" #include "string.h" @@ -871,3 +874,5 @@ SimpleLinkWaitData(unsigned char *pBuf, unsigned char *from, //! @} // //***************************************************************************** + +#endif // MICROPY_HW_ENABLE_CC3K diff --git a/stmhal/cc3k/hci.c b/stmhal/cc3k/hci.c index ef77db95f9..533311f175 100644 --- a/stmhal/cc3k/hci.c +++ b/stmhal/cc3k/hci.c @@ -50,6 +50,9 @@ #include <stdint.h> #include <string.h> // for memcpy +#include "mpconfigport.h" + +#if MICROPY_HW_ENABLE_CC3K #include "cc3000_common.h" #include "hci.h" @@ -240,3 +243,5 @@ hci_patch_send(unsigned char ucOpcode, unsigned char *pucBuff, char *patch, unsi // // //***************************************************************************** + +#endif // MICROPY_HW_ENABLE_CC3K diff --git a/stmhal/cc3k/netapp.c b/stmhal/cc3k/netapp.c index 4b3efb24df..cdeccefc46 100644 --- a/stmhal/cc3k/netapp.c +++ b/stmhal/cc3k/netapp.c @@ -41,6 +41,9 @@ * *****************************************************************************/ #include <stdint.h> +#include "mpconfigport.h" + +#if MICROPY_HW_ENABLE_CC3K #include "netapp.h" #include "hci.h" @@ -475,3 +478,5 @@ long netapp_set_debug_level(unsigned long ulLevel) } #endif + +#endif // MICROPY_HW_ENABLE_CC3K diff --git a/stmhal/cc3k/nvmem.c b/stmhal/cc3k/nvmem.c index 4113620086..774759c41f 100644 --- a/stmhal/cc3k/nvmem.c +++ b/stmhal/cc3k/nvmem.c @@ -50,6 +50,9 @@ #include <stdint.h> #include <string.h> +#include "mpconfigport.h" + +#if MICROPY_HW_ENABLE_CC3K #include "nvmem.h" #include "hci.h" @@ -364,3 +367,4 @@ nvmem_create_entry(unsigned long ulFileId, unsigned long ulNewLen) // //***************************************************************************** +#endif // MICROPY_HW_ENABLE_CC3K diff --git a/stmhal/cc3k/pybcc3k.c b/stmhal/cc3k/pybcc3k.c index 8712a3780b..d43f42f0ba 100644 --- a/stmhal/cc3k/pybcc3k.c +++ b/stmhal/cc3k/pybcc3k.c @@ -17,6 +17,8 @@ #include "ccdebug.h" #include "pybcc3k.h" +#if MICROPY_HW_ENABLE_CC3K + // IRQ on PA14, input, pulled up, active low // EN on PC7, output, active high // CS on PC6, output, active low @@ -165,3 +167,5 @@ uint8_t pyb_cc3000_spi_send(uint8_t val) { HAL_SPI_TransmitReceive(&SPI_HANDLE, data, data, 1, 1000); return data[0]; } + +#endif // MICROPY_HW_ENABLE_CC3K diff --git a/stmhal/cc3k/security.c b/stmhal/cc3k/security.c index c12aee370d..c52d7f67e6 100644 --- a/stmhal/cc3k/security.c +++ b/stmhal/cc3k/security.c @@ -41,6 +41,9 @@ //***************************************************************************** #include <stdint.h> +#include "mpconfigport.h" + +#if MICROPY_HW_ENABLE_CC3K #include "security.h" @@ -533,3 +536,5 @@ signed long aes_write_key(unsigned char *key) //! @} // //***************************************************************************** + +#endif // MICROPY_HW_ENABLE_CC3K diff --git a/stmhal/cc3k/socket.c b/stmhal/cc3k/socket.c index cfccbd7831..86a4549ecf 100644 --- a/stmhal/cc3k/socket.c +++ b/stmhal/cc3k/socket.c @@ -50,6 +50,9 @@ #include <stdint.h> #include <string.h> // for memcpy +#include "mpconfigport.h" + +#if MICROPY_HW_ENABLE_CC3K #include "hci.h" #include "socket.h" @@ -1188,3 +1191,5 @@ mdnsAdvertiser(unsigned short mdnsEnabled, char * deviceServiceName, unsigned sh return ret; } + +#endif // MICROPY_HW_ENABLE_CC3K diff --git a/stmhal/cc3k/wlan.c b/stmhal/cc3k/wlan.c index be6b3242ce..b22796a7c8 100644 --- a/stmhal/cc3k/wlan.c +++ b/stmhal/cc3k/wlan.c @@ -49,6 +49,9 @@ //***************************************************************************** #include <stdlib.h> #include <stdint.h> +#include "mpconfigport.h" + +#if MICROPY_HW_ENABLE_CC3K #include "wlan.h" #include "hci.h" @@ -1262,3 +1265,5 @@ wlan_smart_config_process() //! @} // //***************************************************************************** + +#endif // MICROPY_HW_ENABLE_CC3K diff --git a/stmhal/main.c b/stmhal/main.c index 603bf31889..5faa70e657 100644 --- a/stmhal/main.c +++ b/stmhal/main.c @@ -495,13 +495,11 @@ soft_reset: vstr_free(vstr); } -#if 0 -#if MICROPY_HW_HAS_WLAN - // wifi +#if MICROPY_HW_ENABLE_CC3K + // wifi using the CC3000 driver pyb_wlan_init(); pyb_wlan_start(); #endif -#endif // enter REPL // REPL mode can change, or it can request a soft reset diff --git a/stmhal/pybwlan.c b/stmhal/pybwlan.c index 06309b61c0..fb214209c2 100644 --- a/stmhal/pybwlan.c +++ b/stmhal/pybwlan.c @@ -12,6 +12,8 @@ #include "obj.h" #include "runtime.h" +#if MICROPY_HW_ENABLE_CC3K + #include "cc3k/ccspi.h" #include "cc3k/hci.h" #include "cc3k/socket.h" @@ -377,3 +379,5 @@ void pyb_wlan_start(void) { printf("nvmem_read_sp_version=%d; %02x %02x\n", ret, ver[0], ver[1]); */ } + +#endif // MICROPY_HW_ENABLE_CC3K |