Commit ae8feac5 authored by Damien George's avatar Damien George
Browse files

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.
parent 9c5fc83e
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#define MICROPY_HW_HAS_MMA7660 (0) #define MICROPY_HW_HAS_MMA7660 (0)
#define MICROPY_HW_HAS_LIS3DSH (0) #define MICROPY_HW_HAS_LIS3DSH (0)
#define MICROPY_HW_HAS_LCD (0) #define MICROPY_HW_HAS_LCD (0)
#define MICROPY_HW_HAS_WLAN (0)
#define MICROPY_HW_ENABLE_RNG (1) #define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_RTC (0) #define MICROPY_HW_ENABLE_RTC (0)
#define MICROPY_HW_ENABLE_TIMER (1) #define MICROPY_HW_ENABLE_TIMER (1)
...@@ -20,6 +19,7 @@ ...@@ -20,6 +19,7 @@
#define MICROPY_HW_ENABLE_I2C1 (0) #define MICROPY_HW_ENABLE_I2C1 (0)
#define MICROPY_HW_ENABLE_SPI1 (0) #define MICROPY_HW_ENABLE_SPI1 (0)
#define MICROPY_HW_ENABLE_SPI3 (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. // USRSW is pulled low. Pressing the button makes the input go high.
#define MICROPY_HW_USRSW_PIN (pin_B11) #define MICROPY_HW_USRSW_PIN (pin_B11)
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#define MICROPY_HW_HAS_MMA7660 (1) #define MICROPY_HW_HAS_MMA7660 (1)
#define MICROPY_HW_HAS_LIS3DSH (0) #define MICROPY_HW_HAS_LIS3DSH (0)
#define MICROPY_HW_HAS_LCD (1) #define MICROPY_HW_HAS_LCD (1)
#define MICROPY_HW_HAS_WLAN (1)
#define MICROPY_HW_ENABLE_RNG (1) #define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_RTC (1) #define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_TIMER (1) #define MICROPY_HW_ENABLE_TIMER (1)
...@@ -16,6 +15,7 @@ ...@@ -16,6 +15,7 @@
#define MICROPY_HW_ENABLE_I2C1 (1) #define MICROPY_HW_ENABLE_I2C1 (1)
#define MICROPY_HW_ENABLE_SPI1 (1) #define MICROPY_HW_ENABLE_SPI1 (1)
#define MICROPY_HW_ENABLE_SPI3 (0) #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 // USRSW has no pullup or pulldown, and pressing the switch makes the input go low
#define MICROPY_HW_USRSW_PIN (pin_B3) #define MICROPY_HW_USRSW_PIN (pin_B3)
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#define MICROPY_HW_HAS_MMA7660 (1) #define MICROPY_HW_HAS_MMA7660 (1)
#define MICROPY_HW_HAS_LIS3DSH (0) #define MICROPY_HW_HAS_LIS3DSH (0)
#define MICROPY_HW_HAS_LCD (0) #define MICROPY_HW_HAS_LCD (0)
#define MICROPY_HW_HAS_WLAN (0)
#define MICROPY_HW_ENABLE_RNG (1) #define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_RTC (1) #define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_TIMER (1) #define MICROPY_HW_ENABLE_TIMER (1)
...@@ -16,6 +15,7 @@ ...@@ -16,6 +15,7 @@
#define MICROPY_HW_ENABLE_I2C1 (1) #define MICROPY_HW_ENABLE_I2C1 (1)
#define MICROPY_HW_ENABLE_SPI1 (1) #define MICROPY_HW_ENABLE_SPI1 (1)
#define MICROPY_HW_ENABLE_SPI3 (0) #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 // USRSW has no pullup or pulldown, and pressing the switch makes the input go low
#define MICROPY_HW_USRSW_PIN (pin_A13) #define MICROPY_HW_USRSW_PIN (pin_A13)
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#define MICROPY_HW_HAS_MMA7660 (1) #define MICROPY_HW_HAS_MMA7660 (1)
#define MICROPY_HW_HAS_LIS3DSH (0) #define MICROPY_HW_HAS_LIS3DSH (0)
#define MICROPY_HW_HAS_LCD (1) #define MICROPY_HW_HAS_LCD (1)
#define MICROPY_HW_HAS_WLAN (0)
#define MICROPY_HW_ENABLE_RNG (1) #define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_RTC (1) #define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_TIMER (1) #define MICROPY_HW_ENABLE_TIMER (1)
...@@ -16,6 +15,7 @@ ...@@ -16,6 +15,7 @@
#define MICROPY_HW_ENABLE_I2C1 (1) #define MICROPY_HW_ENABLE_I2C1 (1)
#define MICROPY_HW_ENABLE_SPI1 (1) #define MICROPY_HW_ENABLE_SPI1 (1)
#define MICROPY_HW_ENABLE_SPI3 (0) #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 // USRSW has no pullup or pulldown, and pressing the switch makes the input go low
#define MICROPY_HW_USRSW_PIN (pin_B3) #define MICROPY_HW_USRSW_PIN (pin_B3)
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#define MICROPY_HW_HAS_MMA7660 (0) #define MICROPY_HW_HAS_MMA7660 (0)
#define MICROPY_HW_HAS_LIS3DSH (1) #define MICROPY_HW_HAS_LIS3DSH (1)
#define MICROPY_HW_HAS_LCD (0) #define MICROPY_HW_HAS_LCD (0)
#define MICROPY_HW_HAS_WLAN (0)
#define MICROPY_HW_ENABLE_RNG (1) #define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_RTC (1) #define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_TIMER (1) #define MICROPY_HW_ENABLE_TIMER (1)
...@@ -16,6 +15,7 @@ ...@@ -16,6 +15,7 @@
#define MICROPY_HW_ENABLE_I2C1 (1) #define MICROPY_HW_ENABLE_I2C1 (1)
#define MICROPY_HW_ENABLE_SPI1 (1) #define MICROPY_HW_ENABLE_SPI1 (1)
#define MICROPY_HW_ENABLE_SPI3 (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. // USRSW is pulled low. Pressing the button makes the input go high.
#define MICROPY_HW_USRSW_PIN (pin_A0) #define MICROPY_HW_USRSW_PIN (pin_A0)
......
...@@ -52,6 +52,9 @@ ...@@ -52,6 +52,9 @@
* *
*****************************************************************************/ *****************************************************************************/
#include <stdint.h> #include <stdint.h>
#include "mpconfigport.h"
#if MICROPY_HW_ENABLE_CC3K
#include "cc3000_common.h" #include "cc3000_common.h"
#include "socket.h" #include "socket.h"
...@@ -194,3 +197,5 @@ uint32_t STREAM_TO_UINT32_f(char * cp, uint16_t offset) ...@@ -194,3 +197,5 @@ uint32_t STREAM_TO_UINT32_f(char * cp, uint16_t offset)
//! @} //! @}
// //
//***************************************************************************** //*****************************************************************************
#endif // MICROPY_HW_ENABLE_CC3K
...@@ -42,6 +42,9 @@ ...@@ -42,6 +42,9 @@
*****************************************************************************/ *****************************************************************************/
#include <stdint.h> #include <stdint.h>
#include <string.h> // for memset #include <string.h> // for memset
#include "mpconfigport.h"
#if MICROPY_HW_ENABLE_CC3K
#include "ccspi.h" #include "ccspi.h"
#include "hci.h" #include "hci.h"
...@@ -735,3 +738,5 @@ void cc3k_int_poll() ...@@ -735,3 +738,5 @@ void cc3k_int_poll()
SpiIntGPIOHandler(); SpiIntGPIOHandler();
} }
} }
#endif // MICROPY_HW_ENABLE_CC3K
...@@ -52,6 +52,9 @@ ...@@ -52,6 +52,9 @@
//****************************************************************************** //******************************************************************************
#include <stdint.h> #include <stdint.h>
#include "mpconfigport.h"
#if MICROPY_HW_ENABLE_CC3K
#include "cc3000_common.h" #include "cc3000_common.h"
#include "string.h" #include "string.h"
...@@ -871,3 +874,5 @@ SimpleLinkWaitData(unsigned char *pBuf, unsigned char *from, ...@@ -871,3 +874,5 @@ SimpleLinkWaitData(unsigned char *pBuf, unsigned char *from,
//! @} //! @}
// //
//***************************************************************************** //*****************************************************************************
#endif // MICROPY_HW_ENABLE_CC3K
...@@ -50,6 +50,9 @@ ...@@ -50,6 +50,9 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> // for memcpy #include <string.h> // for memcpy
#include "mpconfigport.h"
#if MICROPY_HW_ENABLE_CC3K
#include "cc3000_common.h" #include "cc3000_common.h"
#include "hci.h" #include "hci.h"
...@@ -240,3 +243,5 @@ hci_patch_send(unsigned char ucOpcode, unsigned char *pucBuff, char *patch, unsi ...@@ -240,3 +243,5 @@ hci_patch_send(unsigned char ucOpcode, unsigned char *pucBuff, char *patch, unsi
// //
// //
//***************************************************************************** //*****************************************************************************
#endif // MICROPY_HW_ENABLE_CC3K
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
* *
*****************************************************************************/ *****************************************************************************/
#include <stdint.h> #include <stdint.h>
#include "mpconfigport.h"
#if MICROPY_HW_ENABLE_CC3K
#include "netapp.h" #include "netapp.h"
#include "hci.h" #include "hci.h"
...@@ -475,3 +478,5 @@ long netapp_set_debug_level(unsigned long ulLevel) ...@@ -475,3 +478,5 @@ long netapp_set_debug_level(unsigned long ulLevel)
} }
#endif #endif
#endif // MICROPY_HW_ENABLE_CC3K
...@@ -50,6 +50,9 @@ ...@@ -50,6 +50,9 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "mpconfigport.h"
#if MICROPY_HW_ENABLE_CC3K
#include "nvmem.h" #include "nvmem.h"
#include "hci.h" #include "hci.h"
...@@ -364,3 +367,4 @@ nvmem_create_entry(unsigned long ulFileId, unsigned long ulNewLen) ...@@ -364,3 +367,4 @@ nvmem_create_entry(unsigned long ulFileId, unsigned long ulNewLen)
// //
//***************************************************************************** //*****************************************************************************
#endif // MICROPY_HW_ENABLE_CC3K
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include "ccdebug.h" #include "ccdebug.h"
#include "pybcc3k.h" #include "pybcc3k.h"
#if MICROPY_HW_ENABLE_CC3K
// IRQ on PA14, input, pulled up, active low // IRQ on PA14, input, pulled up, active low
// EN on PC7, output, active high // EN on PC7, output, active high
// CS on PC6, output, active low // CS on PC6, output, active low
...@@ -165,3 +167,5 @@ uint8_t pyb_cc3000_spi_send(uint8_t val) { ...@@ -165,3 +167,5 @@ uint8_t pyb_cc3000_spi_send(uint8_t val) {
HAL_SPI_TransmitReceive(&SPI_HANDLE, data, data, 1, 1000); HAL_SPI_TransmitReceive(&SPI_HANDLE, data, data, 1, 1000);
return data[0]; return data[0];
} }
#endif // MICROPY_HW_ENABLE_CC3K
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
//***************************************************************************** //*****************************************************************************
#include <stdint.h> #include <stdint.h>
#include "mpconfigport.h"
#if MICROPY_HW_ENABLE_CC3K
#include "security.h" #include "security.h"
...@@ -533,3 +536,5 @@ signed long aes_write_key(unsigned char *key) ...@@ -533,3 +536,5 @@ signed long aes_write_key(unsigned char *key)
//! @} //! @}
// //
//***************************************************************************** //*****************************************************************************
#endif // MICROPY_HW_ENABLE_CC3K
...@@ -50,6 +50,9 @@ ...@@ -50,6 +50,9 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> // for memcpy #include <string.h> // for memcpy
#include "mpconfigport.h"
#if MICROPY_HW_ENABLE_CC3K
#include "hci.h" #include "hci.h"
#include "socket.h" #include "socket.h"
...@@ -1188,3 +1191,5 @@ mdnsAdvertiser(unsigned short mdnsEnabled, char * deviceServiceName, unsigned sh ...@@ -1188,3 +1191,5 @@ mdnsAdvertiser(unsigned short mdnsEnabled, char * deviceServiceName, unsigned sh
return ret; return ret;
} }
#endif // MICROPY_HW_ENABLE_CC3K
...@@ -49,6 +49,9 @@ ...@@ -49,6 +49,9 @@
//***************************************************************************** //*****************************************************************************
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include "mpconfigport.h"
#if MICROPY_HW_ENABLE_CC3K
#include "wlan.h" #include "wlan.h"
#include "hci.h" #include "hci.h"
...@@ -1262,3 +1265,5 @@ wlan_smart_config_process() ...@@ -1262,3 +1265,5 @@ wlan_smart_config_process()
//! @} //! @}
// //
//***************************************************************************** //*****************************************************************************
#endif // MICROPY_HW_ENABLE_CC3K
...@@ -495,12 +495,10 @@ soft_reset: ...@@ -495,12 +495,10 @@ soft_reset:
vstr_free(vstr); vstr_free(vstr);
} }
#if 0 #if MICROPY_HW_ENABLE_CC3K
#if MICROPY_HW_HAS_WLAN // wifi using the CC3000 driver
// wifi
pyb_wlan_init(); pyb_wlan_init();
pyb_wlan_start(); pyb_wlan_start();
#endif
#endif #endif
// enter REPL // enter REPL
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include "obj.h" #include "obj.h"
#include "runtime.h" #include "runtime.h"
#if MICROPY_HW_ENABLE_CC3K
#include "cc3k/ccspi.h" #include "cc3k/ccspi.h"
#include "cc3k/hci.h" #include "cc3k/hci.h"
#include "cc3k/socket.h" #include "cc3k/socket.h"
...@@ -377,3 +379,5 @@ void pyb_wlan_start(void) { ...@@ -377,3 +379,5 @@ void pyb_wlan_start(void) {
printf("nvmem_read_sp_version=%d; %02x %02x\n", ret, ver[0], ver[1]); printf("nvmem_read_sp_version=%d; %02x %02x\n", ret, ver[0], ver[1]);
*/ */
} }
#endif // MICROPY_HW_ENABLE_CC3K
Supports Markdown
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