Poerting the Xbee library to use teh wifi functionality of the LPC4088.

Dependents:   XBee_WiFi_EA_LPC4088

Fork of XBee by Suga koubou

Files at this revision

API Documentation at this revision

Comitter:
marin8703
Date:
Tue Feb 10 21:16:07 2015 +0000
Parent:
7:b36422ef864f
Commit message:
Adapting to LPC4088

Changed in this revision

XBee.cpp Show annotated file Show diff for this revision Revisions of this file
XBee.h Show annotated file Show diff for this revision Revisions of this file
XBeeWiFi.cpp 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
dbg.h Show annotated file Show diff for this revision Revisions of this file
--- a/XBee.cpp	Wed Dec 18 02:32:33 2013 +0000
+++ b/XBee.cpp	Tue Feb 10 21:16:07 2015 +0000
@@ -33,6 +33,8 @@
 #include "mbed.h"
 #include "XBee.h"
 
+extern Serial pc;
+
 XBeeResponse::XBeeResponse() {
 
 }
@@ -630,6 +632,7 @@
 
     // pass pointer array to subclass
     at->setFrameData(getFrameData());
+//    pc.printf("setFrameData: %X \r\n",getFrameData()); //by marin
     setCommon(atCommandResponse);
 }
 
@@ -1447,9 +1450,12 @@
     if (escape && (b == START_BYTE || b == ESCAPE || b == XON || b == XOFF)) {
 //        std::cout << "escaping byte [" << toHexString(b) << "] " << std::endl;
         _xbee.putc(ESCAPE);
+        //pc.printf("**XBee::sendByte(if): %X **\r\n", ESCAPE); //by marin
         _xbee.putc(b ^ 0x20);
+        //pc.printf("**XBee::sendByte(if): %X **\r\n", (b ^ 0x20)); //by marin
     } else {
         _xbee.putc(b);
+        //pc.printf("**XBee::sendByte(else): %X **\r\n", b); //by marin
     }
     DBG("%02x ", b);
 }
--- a/XBee.h	Wed Dec 18 02:32:33 2013 +0000
+++ b/XBee.h	Tue Feb 10 21:16:07 2015 +0000
@@ -33,7 +33,7 @@
 #include "mbed.h"
 #include <inttypes.h>
 
-#define SERIES_1
+//#define SERIES_1
 #define SERIES_2
 #define WIFI
 
@@ -52,7 +52,7 @@
 
 // This value is determined by the largest packet size (100 byte payload + 64-bit address + option byte and rssi byte) of a series 1 radio
 //#define MAX_FRAME_DATA_SIZE 110
-#define MAX_FRAME_DATA_SIZE 1520
+#define MAX_FRAME_DATA_SIZE 1000 //1520
 #define MAX_RXBUF_SIZE 32
 
 #define BROADCAST_ADDRESS 0xffff
--- a/XBeeWiFi.cpp	Wed Dec 18 02:32:33 2013 +0000
+++ b/XBeeWiFi.cpp	Tue Feb 10 21:16:07 2015 +0000
@@ -11,7 +11,7 @@
 #include "XBee_conf.h"
 #ifdef ENABLE_XBEE_WIFI
 
-//#define DEBUG
+#define DEBUG
 #include "dbg.h"
 
 #include "mbed.h"
@@ -237,8 +237,16 @@
     AtCommandResponse atResponse;
 
     getResponse().getAtCommandResponse(atResponse);
+    DBG("**in getWiAddr after getResponse()**\r\n");
+    
+    DBG("**isOK: %d **\r\n", atResponse.isOk() );
+    DBG("**Response length: %d **\r\n", atResponse.getValueLength() );
+    DBG("**Response: %s **\r\n", atResponse.getValue() );
+    
     if (atResponse.isOk() && atResponse.getValueLength() >= 7) {
+        DBG("**Inside getWiAddr if**\r\n");
         sscanf((char*)atResponse.getValue(), "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4);
+        DBG("**ip(getWiAddr): %d.%d.%d.%d **\r\n", ip1,ip2,ip3,ip4);
         ipaddr = IpAddr(ip1, ip2, ip3, ip4);
         return 0;
     }
--- a/XBee_conf.h	Wed Dec 18 02:32:33 2013 +0000
+++ b/XBee_conf.h	Tue Feb 10 21:16:07 2015 +0000
@@ -1,7 +1,7 @@
 #ifndef XBee_conf_h
 #define XBee_conf_h
 
-//#define ENABLE_XBEE_WIFI
+#define ENABLE_XBEE_WIFI
 
 #endif
 
--- a/dbg.h	Wed Dec 18 02:32:33 2013 +0000
+++ b/dbg.h	Tue Feb 10 21:16:07 2015 +0000
@@ -1,7 +1,10 @@
-//#define DEBUG
+#define DEBUG
+#include "mbed.h"
 
 #ifdef DEBUG 
-#define DBG(...) printf("" __VA_ARGS__) 
+#define DBG(...) pc.printf("" __VA_ARGS__) 
 #else 
 #define DBG(...) 
 #endif 
+
+extern Serial pc;
\ No newline at end of file