Prosper Van / xbeeCom

Fork of com by Prosper Van

Files at this revision

API Documentation at this revision

Comitter:
oprospero
Date:
Thu Oct 23 04:46:10 2014 +0000
Parent:
20:95244d4f47f6
Child:
22:0e8e22f161ff
Commit message:
reverted back to single Serial

Changed in this revision

com.cpp Show annotated file Show diff for this revision Revisions of this file
com.h Show annotated file Show diff for this revision Revisions of this file
--- a/com.cpp	Wed Oct 22 16:09:56 2014 +0000
+++ b/com.cpp	Thu Oct 23 04:46:10 2014 +0000
@@ -24,9 +24,10 @@
     #define GET(x)
 #endif
 
-com::com(PinName tx, PinName rx): xbee(NC,rx), xbtx(tx,NC)
+//com::com(PinName tx, PinName rx): xbee(NC,rx), xbtx(tx,NC)
+com::com(PinName tx, PinName rx): xbee(tx,rx)
 {
-    xbtx.baud(BAUDRATE);
+//    xbtx.baud(BAUDRATE);
     xbee.baud(BAUDRATE);
     xbee.attach(this,&com::callback);
 }
@@ -41,7 +42,7 @@
     while(xbee.readable())
     {
         char data = xbee.getc();
-        xbtx.putc(data);
+        xbee.putc(data);
         rxBuffer.add(data);
     }
     __enable_irq();
@@ -154,7 +155,7 @@
 void com::sendACK()
 {
     __disable_irq();
-    if( !txBuffer.isEmpty() && xbtx.writeable() )
+    if( !txBuffer.isEmpty() && xbee.writeable() )
     {
         short * pkt = txBuffer.pop();
         write(pkt[0],pkt[1]); //may need to disable interrupt
@@ -166,10 +167,10 @@
 
 void com::write( short command, short seq  )
 {  
-    xbtx.putc( 255 );                     // End of message.
-    xbtx.putc( (char)command );           // Command
-    xbtx.putc( (char) seq);            // Second 8 bits in array.
-    xbtx.putc( (char) command + seq );        // Checksum array[0] + array[1].
+    xbee.putc( 255 );                     // End of message.
+    xbee.putc( (char)command );           // Command
+    xbee.putc( (char) seq);            // Second 8 bits in array.
+    xbee.putc( (char) command + seq );        // Checksum array[0] + array[1].
 }
 
 void com::print(char* str)
--- a/com.h	Wed Oct 22 16:09:56 2014 +0000
+++ b/com.h	Thu Oct 23 04:46:10 2014 +0000
@@ -23,7 +23,7 @@
     
 private:
     Serial xbee;
-    Serial xbtx;
+//    Serial xbtx;
     queue cmdBuffer;
     queue txBuffer;
     queueChar rxBuffer;