XBeeWiFi (S6) with SPI connection.

Dependencies:   XBeeWiFi_common XBee_with_SPI mbed

Fork of XBee_wifi_sample by Suga koubou

Files at this revision

API Documentation at this revision

Comitter:
ban4jp
Date:
Sat Jan 04 16:58:46 2014 +0000
Parent:
2:8aee4ad2fc1e
Commit message:
Add SPI connection support.

Changed in this revision

EthernetNetIf.lib Show diff for this revision Revisions of this file
XBee.lib Show diff for this revision Revisions of this file
XBeeWiFi_common.lib Show annotated file Show diff for this revision Revisions of this file
XBee_conf.h Show annotated file Show diff for this revision Revisions of this file
XBee_with_SPI.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/EthernetNetIf.lib	Wed Dec 18 02:25:14 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/donatien/code/EthernetNetIf/#bc7df6da7589
--- a/XBee.lib	Wed Dec 18 02:25:14 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/okini3939/code/XBee/#6f84e2840408
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/XBeeWiFi_common.lib	Sat Jan 04 16:58:46 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/ban4jp/code/XBeeWiFi_common/#8dc6b255af6c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/XBee_conf.h	Sat Jan 04 16:58:46 2014 +0000
@@ -0,0 +1,10 @@
+#ifndef XBee_conf_h
+#define XBee_conf_h
+
+#define ENABLE_XBEE_WIFI
+
+#define USE_XBEE_SPI
+//#define USE_WIFIDNS
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/XBee_with_SPI.lib	Sat Jan 04 16:58:46 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/ban4jp/code/XBee_with_SPI/#eb70be6ceb6d
--- a/main.cpp	Wed Dec 18 02:25:14 2013 +0000
+++ b/main.cpp	Sat Jan 04 16:58:46 2014 +0000
@@ -21,8 +21,11 @@
 DigitalOut myled(LED1);
 Serial pc(USBTX, USBRX);
 
-XBeeWiFi xbee(p13, p14, p12, P0_22); // TX, RX, CTS, RTS
-//XBeeWiFi xbee(p13, p14, p12, p11); // TX, RX, CTS, RTS
+#if defined(TARGET_LPC1768) || defined(TARGET_LPC11U24)
+XBeeWiFi xbee(p11, p12, p13, p14, p15, p16);    // mosi, miso, sclk, ssel, attn, reset
+#elif defined(TARGET_LPC1114)
+XBeeWiFi xbee(dp2, dp1, dp6, dp9, dp10, dp11);  // mosi, miso, sclk, ssel, attn, reset
+#endif
 
 int init_wifi (int timeout) {
     int i, r;
@@ -154,13 +157,13 @@
 }
 
 int main() {
-    int i;
+//    int i;
     IpAddr ipaddr, netmask, gateway, nameserver;
     Host host;
 
-    xbee.begin(115200);
+//    xbee.begin(115200);
 //    xbee.baud(921000);
-    pc.baud(115200);
+    pc.baud(9600);
     pc.printf("XBee WiFi test\r\n");
 
     if (init_wifi(20)) {
@@ -170,7 +173,7 @@
 
     xbee.getAddress(ipaddr, netmask, gateway, nameserver);
     pc.printf("IP address %d.%d.%d.%d\r\n", ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]);
-    if (ipaddr == 0) {
+    if (ipaddr.isNull()) {
         pc.printf("not configure\r\n");
         return -1;
     }
@@ -194,23 +197,11 @@
 */
     // HTTP request
     wait(1);
-    host.setIp(IpAddr(217,140,96,42));
-    host.setName("mbed.org");
-    httpRequest(METHOD_GET, &host, "/", "", "");
+    host.setIp(IpAddr(54,243,166,106));
+    host.setName("httpbin.org");
+    httpRequest(METHOD_GET, &host, "/get", "", "");
 
-    // Serial through
-    {
-        Serial xbeeserial(p13, p14);
-        DigitalOut rts(p22);
-        
-        xbeeserial.baud(115200);
-        rts = 0;
-        pc.printf("Serial through\r\n");
-        for (;;) {
-            if (pc.readable()) xbeeserial.putc(pc.getc());
-            if (xbeeserial.readable()) pc.putc(xbeeserial.getc());
-//            if (xbeeserial.readable()) pc.printf("%02x ", xbeeserial.getc());
-        }
-    }
+    pc.printf("done.\r\n");
+    while(1);
 
 }
--- a/mbed.bld	Wed Dec 18 02:25:14 2013 +0000
+++ b/mbed.bld	Sat Jan 04 16:58:46 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e
+http://mbed.org/users/mbed_official/code/mbed/builds/dc225afb6914
\ No newline at end of file