Yoshito Onishi / XBee

Fork of XBee by Suga koubou

Files at this revision

API Documentation at this revision

Comitter:
FalconOnishi
Date:
Fri Jan 18 17:00:51 2013 +0000
Parent:
5:547cfff7adf7
Commit message:
Add some utility methods

Changed in this revision

XBee.cpp 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
--- a/XBee.cpp	Tue Mar 13 09:11:35 2012 +0000
+++ b/XBee.cpp	Fri Jan 18 17:00:51 2013 +0000
@@ -25,7 +25,7 @@
  * @brief XBee library for mbed
  */
 
-//#define DEBUG
+#define DEBUG
 #include "dbg.h"
 
 #include "mbed.h"
@@ -857,7 +857,7 @@
                 continue;
             }
         }
-        DBG("%02x_", b);
+        //DBG("%02x_", b);
 
         if (_escape == true) {
             b = 0x20 ^ b;
@@ -1396,6 +1396,16 @@
 //    _frame = frame;
 //}
 
+void flushSerialBuffer(Serial &device) 
+{ 
+    char c = 0; 
+    while (device.readable()) { 
+        c = device.getc(); 
+        c = c;//escape warning
+    }
+    return; 
+}
+
 void XBee::send(XBeeRequest &request) {
     // the new new deal
 
@@ -1437,7 +1447,9 @@
     // send packet
     Serial.flush();
 */
-    DBG("\r\n");
+    flushSerialBuffer(_xbee);
+
+//    DBG("\r\n");
 }
 
 void XBee::sendByte(uint8_t b, bool escape) {
@@ -1449,6 +1461,6 @@
     } else {
         _xbee.putc(b);
     }
-    DBG("%02x ", b);
+//    DBG("%02x ", b);
 }
 
--- a/XBeeWiFi.cpp	Tue Mar 13 09:11:35 2012 +0000
+++ b/XBeeWiFi.cpp	Fri Jan 18 17:00:51 2013 +0000
@@ -8,7 +8,7 @@
  * @brief XBee Wi-Fi library for mbed
  */
 
-//#define DEBUG
+#define DEBUG
 #include "dbg.h"
 
 #include "mbed.h"