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 20:95244d4f47f6, committed 2014-10-22
- Comitter:
- oprospero
- Date:
- Wed Oct 22 16:09:56 2014 +0000
- Parent:
- 19:dc9d18037565
- Child:
- 21:117e01fc0373
- Commit message:
- currently debuging
Changed in this revision
com.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/com.cpp Tue Oct 21 21:22:21 2014 +0000 +++ b/com.cpp Wed Oct 22 16:09:56 2014 +0000 @@ -26,6 +26,7 @@ com::com(PinName tx, PinName rx): xbee(NC,rx), xbtx(tx,NC) { + xbtx.baud(BAUDRATE); xbee.baud(BAUDRATE); xbee.attach(this,&com::callback); } @@ -40,7 +41,7 @@ while(xbee.readable()) { char data = xbee.getc(); -// xbee.putc(data); + xbtx.putc(data); rxBuffer.add(data); } __enable_irq(); @@ -58,7 +59,7 @@ while ( !rxBuffer.isEmpty() ) { char data = rxBuffer.pop(); - __enable_irq(); +// __enable_irq(); // PRINTF("d: %d \n\r", data); switch (packetIndex) { @@ -108,7 +109,7 @@ pack_checksum = data; if ( temp == pack_checksum ) { - __disable_irq(); +// __disable_irq(); short * ackPacket = new short[2]; ackPacket[0] = pack_cmd; ackPacket[1] = pack_seq; @@ -118,7 +119,7 @@ array[0] = pack_cmd; array[1] = pack_value[1] * 128 + pack_value[0]; cmdBuffer.add( array ); - __enable_irq(); +// __enable_irq(); } packetIndex = 0; @@ -129,7 +130,7 @@ break; } - __disable_irq(); +// __disable_irq(); } __enable_irq(); @@ -153,7 +154,7 @@ void com::sendACK() { __disable_irq(); - if( !txBuffer.isEmpty()) + if( !txBuffer.isEmpty() && xbtx.writeable() ) { short * pkt = txBuffer.pop(); write(pkt[0],pkt[1]); //may need to disable interrupt