xbee_lib from Tristan Hughes with some changes by zac dannelly

Dependents:   potSend potGet serialRangeGet

Fork of xbee_lib by Tristan Hughes

Files at this revision

API Documentation at this revision

Comitter:
dannellyz
Date:
Sun Feb 15 16:37:05 2015 +0000
Parent:
4:ede20c047d8b
Commit message:
added RecieveDataChar

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
diff -r ede20c047d8b -r ea7028edb762 xbee.cpp
--- a/xbee.cpp	Wed Aug 29 14:34:53 2012 +0000
+++ b/xbee.cpp	Sun Feb 15 16:37:05 2015 +0000
@@ -122,6 +122,23 @@
     }
 }
 
+void xbee::RecieveDataChar(char *data_buf, char endNow)
+{
+    char current;
+    char ending;
+    Serial DATA(_tx,_rx);
+    ending= '^';
+    while(ending!=endNow) {
+        if(DATA.readable()) {
+            current = DATA.getc();
+            ending = current;
+            *data_buf = current;
+            data_buf+=1;
+        }
+    *data_buf = 0;
+    }
+}
+
 int xbee::SetPanId(int pan_id)
 {
     Serial DATA(_tx,_rx);
diff -r ede20c047d8b -r ea7028edb762 xbee.h
--- a/xbee.h	Wed Aug 29 14:34:53 2012 +0000
+++ b/xbee.h	Sun Feb 15 16:37:05 2015 +0000
@@ -70,6 +70,11 @@
       * @param numchar Number of characters to read. If 0, will use the size of data_buf.
       */
     void RecieveData(char*, int);
+    /** Recieves data sent to the xbee.
+      * @param data_buf Pointer to the buffer to put recieved data into.
+      * @param char character to end the transmission on.
+      */
+    void RecieveDataChar(char*, char);
         /** Resets the Xbee.
       */
     void Reset();