8000 stmhal: Wrap CC3000 driver in MICROPY_HW_ENABLE_CC3K. · hellcoderz/micropython@ae8feac · GitHub
[go: up one dir, main page]

Skip to content

Commit ae8feac

Browse files
committed
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.
1 parent 9c5fc83 commit ae8feac

File tree

17 files changed

+59
-9
lines changed

17 files changed

+59
-9
lines changed

stmhal/boards/NETDUINO_PLUS_2/mpconfigboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#define MICROPY_HW_HAS_MMA7660 (0)
1212
#define MICROPY_HW_HAS_LIS3DSH (0)
1313
#define MICROPY_HW_HAS_LCD (0)
14-
#define MICROPY_HW_HAS_WLAN (0)
1514
#define MICROPY_HW_ENABLE_RNG (1)
1615
#define MICROPY_HW_ENABLE_RTC (0)
1716
#define MICROPY_HW_ENABLE_TIMER (1)
@@ -20,6 +19,7 @@
2019
#define MICROPY_HW_ENABLE_I2C1 (0)
2120
#define MICROPY_HW_ENABLE_SPI1 (0)
2221
#define MICROPY_HW_ENABLE_SPI3 (0)
22+
#define MICROPY_HW_ENABLE_CC3K (0)
2323

2424
// USRSW is pulled low. Pressing the button makes the input go high.
2525
#define MICROPY_HW_USRSW_PIN (pin_B11)

stmhal/boards/PYBV10/mpconfigboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#define MICROPY_HW_HAS_MMA7660 (1)
88
#define MICROPY_HW_HAS_LIS3DSH (0)
99
#define MICROPY_HW_HAS_LCD (1)
10-
#define MICROPY_HW_HAS_WLAN (1)
1110
#define MICROPY_HW_ENABLE_RNG (1)
1211
#define MICROPY_HW_ENABLE_RTC (1)
1312
#define MICROPY_HW_ENABLE_TIMER (1)
@@ -16,6 +15,7 @@
1615
#define MICROPY_HW_ENABLE_I2C1 (1)
1716
#define MICROPY_HW_ENABLE_SPI1 (1)
1817
#define MICROPY_HW_ENABLE_SPI3 (0)
18+
#define MICROPY_HW_ENABLE_CC3K (0)
1919

2020
// USRSW has no pullup or pulldown, and pressing the switch makes the input go low
2121
#define MICROPY_HW_USRSW_PIN (pin_B3)

stmhal/boards/PYBV3/mpconfigboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#define MICROPY_HW_HAS_MMA7660 (1)
88
#define MICROPY_HW_HAS_LIS3DSH (0)
99
#define MICROPY_HW_HAS_LCD (0)
10-
#define MICROPY_HW_HAS_WLAN (0)
1110
#define MICROPY_HW_ENABLE_RNG (1)
1211
#define MICROPY_HW_ENABLE_RTC (1)
1312
#define MICROPY_HW_ENABLE_TIMER (1)
@@ -16,6 +15,7 @@
1615
#define MICROPY_HW_ENABLE_I2C1 (1)
1716
#define MICROPY_HW_ENABLE_SPI1 (1)
1817
#define MICROPY_HW_ENABLE_SPI3 (0)
18+
#define MICROPY_HW_ENABLE_CC3K (0)
1919

2020
// USRSW has no pullup or pulldown, and pressing the switch makes the input go low
2121
#define MICROPY_HW_USRSW_PIN (pin_A13)

stmhal/boards/PYBV4/mpconfigboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#define MICROPY_HW_HAS_MMA7660 (1)
88
#define MICROPY_HW_HAS_LIS3DSH (0)
99
#define MICROPY_HW_HAS_LCD (1)
10-
#define MICROPY_HW_HAS_WLAN (0)
1110
#define MICROPY_HW_ENABLE_RNG (1)
1211
#define MICROPY_HW_ENABLE_RTC (1)
1312
#define MICROPY_HW_ENABLE_TIMER (1)
@@ -16,6 +15,7 @@
1615
#define MICROPY_HW_ENABLE_I2C1 (1)
1716
#define MICROPY_HW_ENABLE_SPI1 (1)
1817
#define MICROPY_HW_ENABLE_SPI3 (0)
18+
#define MICROPY_HW_ENABLE_CC3K (0)
1919

2020
// USRSW has no pullup or pulldown, and pressing the switch makes the input go low
2121
#define MICROPY_HW_USRSW_PIN (pin_B3)

stmhal/boards/STM32F4DISC/mpconfigboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#define MICROPY_HW_HAS_MMA7660 (0)
88
#define MICROPY_HW_HAS_LIS3DSH (1)
99
#define MICROPY_HW_HAS_LCD (0)
10-
#define MICROPY_HW_HAS_WLAN (0)
1110
#define MICROPY_HW_ENABLE_RNG (1)
1211
#define MICROPY_HW_ENABLE_RTC (1)
1312
#define MICROPY_HW_ENABLE_TIMER (1)
@@ -16,6 +15,7 @@
1615
#define MICROPY_HW_ENABLE_I2C1 (1)
1716
#define MICROPY_HW_ENABLE_SPI1 (1)
1817
#define MICROPY_HW_ENABLE_SPI3 (0)
18+
#define MICROPY_HW_ENABLE_CC3K (0)
1919

2020
// USRSW is pulled low. Pressing the button makes the input go high.
2121
#define MICROPY_HW_USRSW_PIN (pin_A0)

stmhal/cc3k/cc3000_common.c

Lines changed: 5 additions & 0 F438 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
*
5353
*****************************************************************************/
5454
#include <stdint.h>
55+
#include "mpconfigport.h"
56+
57+
#if MICROPY_HW_ENABLE_CC3K
5558

5659
#include "cc3000_common.h"
5760
#include "socket.h"
@@ -194,3 +197,5 @@ uint32_t STREAM_TO_UINT32_f(char * cp, uint16_t offset)
194197
//! @}
195198
//
196199
//*****************************************************************************
200+
201+
#endif // MICROPY_HW_ENABLE_CC3K

stmhal/cc3k/ccspi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
*****************************************************************************/
4343
#include <stdint.h>
4444
#include <string.h> // for memset
45+
#include "mpconfigport.h"
46+
47+
#if MICROPY_HW_ENABLE_CC3K
4548

4649
#include "ccspi.h"
4750
#include "hci.h"
@@ -735,3 +738,5 @@ void cc3k_int_poll()
735738
SpiIntGPIOHandler();
736739
}
737740
}
741+
742+
#endif // MICROPY_HW_ENABLE_CC3K

stmhal/cc3k/evnt_handler.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
//******************************************************************************
5353

5454
#include <stdint.h>
55+
#include "mpconfigport.h"
56+
57+
#if MICROPY_HW_ENABLE_CC3K
5558

5659
#include "cc3000_common.h"
5760
#include "string.h"
@@ -871,3 +874,5 @@ SimpleLinkWaitData(unsigned char *pBuf, unsigned char *from,
871874
//! @}
872875
//
873876
//*****************************************************************************
877+
878+
#endif // MICROPY_HW_ENABLE_CC3K

stmhal/cc3k/hci.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050

5151
#include <stdint.h>
5252
#include <string.h> // for memcpy
53+
#include "mpconfigport.h"
54+
55+
#if MICROPY_HW_ENABLE_CC3K
5356

5457
#include "cc3000_common.h"
5558
#include "hci.h"
@@ -240,3 +243,5 @@ hci_patch_send(unsigned char ucOpcode, unsigned char *pucBuff, char *patch, unsi
240243
//
241244
//
242245
//*****************************************************************************
246+
247+
#endif // MICROPY_HW_ENABLE_CC3K

stmhal/cc3k/netapp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
*
4242
*****************************************************************************/
4343
#include <stdint.h>
44+
#include "mpconfigport.h"
45+
46+
#if MICROPY_HW_ENABLE_CC3K
4447

4548
#include "netapp.h"
4649
#include "hci.h"
@@ -475,3 +478,5 @@ long netapp_set_debug_level(unsigned long ulLevel)
475478

476479
}
477480
#endif
481+
482+
#endif // MICROPY_HW_ENABLE_CC3K

stmhal/cc3k/nvmem.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050

5151
#include <stdint.h>
5252
#include <string.h>
53+
#include "mpconfigport.h"
54+
55+
#if MICROPY_HW_ENABLE_CC3K
5356

5457
#include "nvmem.h"
5558
#include "hci.h"
@@ -364,3 +367,4 @@ nvmem_create_entry(unsigned long ulFileId, unsigned long ulNewLen)
364367
//
365368
//*****************************************************************************
366369

370+
#endif // MICROPY_HW_ENABLE_CC3K

stmhal/cc3k/pybcc3k.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "ccdebug.h"
1818
#include "pybcc3k.h"
1919

20+
#if MICROPY_HW_ENABLE_CC3K
21+
2022
// IRQ on PA14, input, pulled up, active low
2123
// EN on PC7, output, active high
2224
// CS on PC6, output, active low
@@ -165,3 +167,5 @@ uint8_t pyb_cc3000_spi_send(uint8_t val) {
165167
HAL_SPI_TransmitReceive(&SPI_HANDLE, data, data, 1, 1000);
166168
return data[0];
167169
}
170+
171+
#endif // MICROPY_HW_ENABLE_CC3K

stmhal/cc3k/security.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
//*****************************************************************************
4242

4343
#include <stdint.h>
44+
#include "mpconfigport.h"
45+
46+
#if MICROPY_HW_ENABLE_CC3K
4447

4548
#include "security.h"
4649

@@ -533,3 +536,5 @@ signed long aes_write_key(unsigned char *key)
533536
//! @}
534537
//
535538
//*****************************************************************************
539+
540+
#endif // MICROPY_HW_ENABLE_CC3K

stmhal/cc3k/socket.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050

5151
#include <stdint.h>
5252
#include <string.h> // for memcpy
53+
#include "mpconfigport.h"
54+
55+
#if MICROPY_HW_ENABLE_CC3K
5356

5457
#include "hci.h"
5558
#include "socket.h"
@@ -1188,3 +1191,5 @@ mdnsAdvertiser(unsigned short mdnsEnabled, char * deviceServiceName, unsigned sh
11881191
return ret;
11891192

11901193
}
1194+
1195+
#endif // MICROPY_HW_ENABLE_CC3K

stmhal/cc3k/wlan.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
//*****************************************************************************
5050
#include <stdlib.h>
5151
#include <stdint.h>
52+
#include "mpconfigport.h"
53+
54+
#if MICROPY_HW_ENABLE_CC3K
5255

5356
#include "wlan.h"
5457
#include "hci.h"
@@ -1262,3 +1265,5 @@ wlan_smart_config_process()
12621265
//! @}
12631266
//
12641267
//*****************************************************************************
1268+
1269+
#endif // MICROPY_HW_ENABLE_CC3K

stmhal/main.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,12 +495,10 @@ int main(void) {
495495
vstr_free(vstr);
496496
}
497497

498-
#if 0
499-
#if MICROPY_HW_HAS_WLAN
500-
// wifi
498+
#if MICROPY_HW_ENABLE_CC3K
499+
// wifi using the CC3000 driver
501500
pyb_wlan_init();
502501
pyb_wlan_start();
503-
#endif
504502
#endif
505503

506504
// enter REPL

stmhal/pybwlan.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include "obj.h"
1313
#include "runtime.h"
1414

15+
#if MICROPY_HW_ENABLE_CC3K
16+
1517
#include "cc3k/ccspi.h"
1618
#include "cc3k/hci.h"
1719
#include "cc3k/socket.h"
@@ -377,3 +379,5 @@ void pyb_wlan_start(void) {
377379
printf("nvmem_read_sp_version=%d; %02x %02x\n", ret, ver[0], ver[1]);
378380
*/
379381
}
382+
383+
#endif // MICROPY_HW_ENABLE_CC3K

0 commit comments

Comments
 (0)
0