ok
Dependencies: mbed
Fork of AX12 by
Revision 4:1200e221d94d, committed 2016-04-22
- Comitter:
- dconsoli
- Date:
- Fri Apr 22 17:52:24 2016 +0000
- Parent:
- 3:ced71d1b2558
- Commit message:
- ok;
Changed in this revision
--- a/AX12.cpp Sun Apr 10 21:20:44 2011 +0000 +++ b/AX12.cpp Fri Apr 22 17:52:24 2016 +0000 @@ -24,8 +24,10 @@ #include "AX12.h" #include "mbed.h" -AX12::AX12(PinName tx, PinName rx, int ID, int baud) - : _ax12(tx,rx) { +AX12::AX12(PinName tx, PinName rx, PinName en, int ID, int baud) + : _ax12(tx,rx), + direction_port(en) { + direction_port = 0; _baud = baud; _ID = ID; _ax12.baud(_baud); @@ -345,7 +347,7 @@ #ifdef AX12_READ_DEBUG printf(" Checksum : 0x%x\n",TxBuf[7]); #endif - + direction_port = 1; // Transmit the packet in one burst with no pausing for (int i = 0; i<8 ; i++) { _ax12.putc(TxBuf[i]); @@ -353,7 +355,7 @@ // Wait for the bytes to be transmitted wait (0.00002); - + direction_port = 0; // Skip if the read was to the broadcast address if (_ID != 0xFE) { @@ -484,13 +486,14 @@ #endif // Transmit the packet in one burst with no pausing + direction_port = 1; for (int i = 0; i < (7 + bytes) ; i++) { _ax12.putc(TxBuf[i]); } // Wait for data to transmit wait (0.00002); - + direction_port = 0; // make sure we have a valid return Status[4]=0x00;
--- a/AX12.h Sun Apr 10 21:20:44 2011 +0000 +++ b/AX12.h Fri Apr 22 17:52:24 2016 +0000 @@ -78,7 +78,7 @@ * @param pin rx pin * @param int ID, the Bus ID of the servo 1-255 */ - AX12(PinName tx, PinName rx, int ID, int baud=1000000); + AX12(PinName tx, PinName rx, PinName en, int ID, int baud=1000000); /** Set the mode of the servo * @param mode @@ -180,7 +180,8 @@ private : - SerialHalfDuplex _ax12; + Serial _ax12; + DigitalOut direction_port; int _ID; int _baud;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Apr 22 17:52:24 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f \ No newline at end of file