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.
This commit is contained in:
Damien George 2014-05-03 17:32:55 +01:00
parent 9c5fc83e6a
commit ae8feac598
17 changed files with 59 additions and 9 deletions

View File

@ -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 @@
#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)

View File

@ -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 @@
#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)

View File

@ -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 @@
#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)

View File

@ -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 @@
#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)

View File

@ -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 @@
#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)

View File

@ -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)
//! @} //! @}
// //
//***************************************************************************** //*****************************************************************************
#endif // MICROPY_HW_ENABLE_CC3K

View File

@ -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()
SpiIntGPIOHandler(); SpiIntGPIOHandler();
} }
} }
#endif // MICROPY_HW_ENABLE_CC3K

View File

@ -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,
//! @} //! @}
// //
//***************************************************************************** //*****************************************************************************
#endif // MICROPY_HW_ENABLE_CC3K

View File

@ -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
// //
// //
//***************************************************************************** //*****************************************************************************
#endif // MICROPY_HW_ENABLE_CC3K

View File

@ -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)
} }
#endif #endif
#endif // MICROPY_HW_ENABLE_CC3K

View File

@ -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)
// //
//***************************************************************************** //*****************************************************************************
#endif // MICROPY_HW_ENABLE_CC3K

View File

@ -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) {
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

View File

@ -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)
//! @} //! @}
// //
//***************************************************************************** //*****************************************************************************
#endif // MICROPY_HW_ENABLE_CC3K

View File

@ -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
return ret; return ret;
} }
#endif // MICROPY_HW_ENABLE_CC3K

View File

@ -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()
//! @} //! @}
// //
//***************************************************************************** //*****************************************************************************
#endif // MICROPY_HW_ENABLE_CC3K

View File

@ -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

View File

@ -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) {
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