Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of com by
Revision 21:117e01fc0373, committed 2014-10-23
- 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;