Sparkfun CC3000 WiFi Shield meets mbed. Supports the following boards: (1)FRDM-KL25Z (KL25Z) (2)ST Nucleo F401RE (STM32F401) (3)ST Nucleo F030R8 (STM32F030) (4)LPCXpresso1549 (LPC1549) (5)Seeduino-Arch-Pro (ARCH_PRO)

Dependencies:   cc3000_hostdriver_mbedsocket mbed

Fork of cc3000_hello_world_demo by Martin Kojtal

Files at this revision

API Documentation at this revision

Comitter:
xshige
Date:
Sun Aug 31 02:52:45 2014 +0000
Parent:
6:9f2ba6521ecc
Commit message:
Sparkfun CC3000 WiFi Shield meets mbed!; This program supports the following mbed boards with Sparkfun CC3000 WiFi Sheild. FRDM-KL25Z, ST Nucleo F401RE, ST Nucleo F030R8,LPCXpresso1549,Seeduino-Arch-Pro (ARCH_PRO); ;

Changed in this revision

NVIC_set_all_priorities.lib Show diff for this revision Revisions of this file
cc3000_hostdriver_mbedsocket.lib Show annotated file Show diff for this revision Revisions of this file
init.cpp Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
main.h Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 9f2ba6521ecc -r e450e59b0cf8 NVIC_set_all_priorities.lib
--- a/NVIC_set_all_priorities.lib	Tue Jun 03 08:07:15 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/frankvnk/code/NVIC_set_all_priorities/#676bbfffe9f6
diff -r 9f2ba6521ecc -r e450e59b0cf8 cc3000_hostdriver_mbedsocket.lib
--- a/cc3000_hostdriver_mbedsocket.lib	Tue Jun 03 08:07:15 2014 +0000
+++ b/cc3000_hostdriver_mbedsocket.lib	Sun Aug 31 02:52:45 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/Kojto/code/cc3000_hostdriver_mbedsocket/#50ab13d8f2dc
+http://mbed.org/users/Kojto/code/cc3000_hostdriver_mbedsocket/#ca8c234997c0
diff -r 9f2ba6521ecc -r e450e59b0cf8 init.cpp
--- a/init.cpp	Tue Jun 03 08:07:15 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "main.h"
-#include "mbed.h"
-
-#if (MY_BOARD == WIGO)
-
-#include "NVIC_set_all_priorities.h"
-
-/**
- *  \brief Wi-Go initialization
- *  \param none
- *  \return none
- */
-void init() {
-    DigitalOut PWR_EN1(PTB2);
-    DigitalOut PWR_EN2(PTB3);
-
-    // Wi-Go set current to 500mA since we're turning on the Wi-Fi
-    PWR_EN1 = 0;
-    PWR_EN2 = 1;
-
-    NVIC_set_all_irq_priorities(3);
-    NVIC_SetPriority(SPI0_IRQn, 0x0);     // Wi-Fi SPI interrupt must be higher priority than SysTick
-    NVIC_SetPriority(PORTA_IRQn, 0x1);
-    NVIC_SetPriority(SysTick_IRQn, 0x2);  // SysTick set to lower priority than Wi-Fi SPI bus interrupt
-    PORTA->PCR[16] |=PORT_PCR_ISF_MASK;
-    PORTA->ISFR |= (1 << 16);
-}
-
-#elif (MY_BOARD == WIFI_DIPCORTEX)
-
-/**
- *  \brief Wifi DipCortex initialization
- *  \param none
- *  \return none
- */
-void init() {
-    NVIC_SetPriority(SSP1_IRQn, 0x0);
-    NVIC_SetPriority(PIN_INT0_IRQn, 0x1);
-
-    // SysTick set to lower priority than Wi-Fi SPI bus interrupt
-    NVIC_SetPriority(SysTick_IRQn, 0x2);
-}
-
-#else
-
-/**
- *  \brief Place here init routine for your board
- *  \param none
- *  \return none
- */
-void init() {
-
-}
-
-#endif
diff -r 9f2ba6521ecc -r e450e59b0cf8 main.cpp
--- a/main.cpp	Tue Jun 03 08:07:15 2014 +0000
+++ b/main.cpp	Sun Aug 31 02:52:45 2014 +0000
@@ -1,3 +1,27 @@
+/*
+    Sparkfun CC3000 WiFi Shield meets mbed!
+       
+    This program supports the following mbed boards with Sparkfun CC3000 Sheild.
+    '#define' switches board.(refer to source code)
+    (1)FRDM-KL25Z (KL25Z)
+    (2)ST Nucleo F401RE (STM32F401)
+    (3)ST Nucleo F030R8 (STM32F030)
+    (4)LPCXpresso1549 (LPC1549)
+    (5)Seeduino-Arch-Pro (ARCH_PRO)
+
+  reference:  
+    https://www.sparkfun.com/products/12071 for CC300 Shield
+
+  date: 2014/8/31
+  modified by: xshige
+  
+  #you get sucess when you see the following on the console.
+  cc3000 Hello World demo.
+  IP address: 192.168.0.2
+
+  cc3000 connected to the Internet. Demo completed.
+  
+*/
 /* mbed Microcontroller Library
  * Copyright (c) 2006-2013 ARM Limited
  *
@@ -15,23 +39,49 @@
  */
 #include "mbed.h"
 #include "cc3000.h"
-#include "main.h"
+
+// define board you like (KL25Z, LPC1549, STM32F401, STM32F030 ...)
+//#define KL25Z
+#define STM32F401
+//#define STM32F030
+//#define LPC1549
+//#define ARCH_PRO
+
+// define SSID, PASSWORD you like
+#define SSID "ssid"
+#define PASSWORD "password"
 
 using namespace mbed_cc3000;
 
-/* cc3000 module declaration specific for user's board. Check also init() */
-#if (MY_BOARD == WIGO)
-cc3000 wifi(PTA16, PTA13, PTD0, SPI(PTD2, PTD3, PTC5), "ssid", "key", WPA2, false);
+/* cc3000 module declaration specific for user's board. */
+#if defined(KL25Z)
+// for KL25Z
+cc3000 wifi(PTD4, PTC9, PTD0, SPI(PTD2, PTD3, PTD1), SSID, PASSWORD, WPA2, false);
 Serial pc(USBTX, USBRX);
-#elif (MY_BOARD == WIFI_DIPCORTEX)
-cc3000 wifi(p28, p27, p30, SPI(p21, p14, p37), "ssid", "key", WPA2, false);
-Serial pc(UART_TX, UART_RX);
-#elif (MY_BOARD == MBED_BOARD_EXAMPLE)
-cc3000 wifi(p9, p10, p8, SPI(p5, p6, p7), "ssid", "key", WPA2, false);
+#endif
+#if defined(STM32F401)
+// for Nucleo STM32F401
+cc3000 wifi(PA_10, PA_8, PB_6, SPI(PA_7, PA_6, PA_5), SSID, PASSWORD, WPA2, false);
+// for Nucleo STM32F401
+Serial pc(SERIAL_TX, SERIAL_RX);
+#endif
+#if defined(STM32F030)
+// for Nucleo STM32F030
+cc3000 wifi(PA_10, PA_8, PB_6, SPI(PA_7, PA_6, PA_5), SSID, PASSWORD, WPA2, false);
+// for Nucleo STM32F030
+Serial pc(SERIAL_TX, SERIAL_RX);
+#endif
+#if defined(LPC1549)
+// for LPC1549
+cc3000 wifi(P0_29, P0_0, P0_27, SPI(P0_28, P0_12, P0_16), SSID, PASSWORD, WPA2, false);
 Serial pc(USBTX, USBRX);
-#else
+#endif
+#if defined(ARCH_PRO)
+// for Seeed Studio Arch Pro
+cc3000 wifi(P0_4, P2_5, P0_6, SPI(P0_9, P0_8, P0_7), SSID, PASSWORD, WPA2, false);
+Serial pc(USBTX, USBRX);
+#endif
 
-#endif
 
 /**
  *  \brief Hello World
@@ -39,7 +89,6 @@
  *  \return int
  */
 int main() {
-    init(); /* board dependent init */
     pc.baud(115200);
 
     printf("cc3000 Hello World demo. \r\n");
diff -r 9f2ba6521ecc -r e450e59b0cf8 main.h
--- a/main.h	Tue Jun 03 08:07:15 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MAIN_H
-#define MAIN_H
-
-#define WIGO               1
-#define WIFI_DIPCORTEX     2
-#define MBED_BOARD_EXAMPLE 3
-#define UNDEFINED          4
-
-#define MY_BOARD WIGO
-
-void init();
-
-#endif
diff -r 9f2ba6521ecc -r e450e59b0cf8 mbed.bld
--- a/mbed.bld	Tue Jun 03 08:07:15 2014 +0000
+++ b/mbed.bld	Sun Aug 31 02:52:45 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013
\ No newline at end of file