pierre Rousselin
/
AX12
a
Fork of AX12 by
Revision 4:a7c95f3012db, committed 2017-10-18
- Comitter:
- ROUSSELIN
- Date:
- Wed Oct 18 11:58:25 2017 +0000
- Parent:
- 3:ced71d1b2558
- Commit message:
- For Apollo
Changed in this revision
--- a/AX12.cpp Sun Apr 10 21:20:44 2011 +0000 +++ b/AX12.cpp Wed Oct 18 11:58:25 2017 +0000 @@ -1,34 +1,11 @@ -/* mbed AX-12+ Servo Library - * - * Copyright (c) 2010, cstyles (http://mbed.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +#include "AX12.h" + -#include "AX12.h" -#include "mbed.h" - -AX12::AX12(PinName tx, PinName rx, int ID, int baud) +AX12::AX12(int tx, int rx, int ID, int baud) : _ax12(tx,rx) { - _baud = baud; - _ID = ID; - _ax12.baud(_baud); + _baud = baud; + _ID = ID; + int _ax12.baud(_baud); } @@ -351,9 +328,6 @@ _ax12.putc(TxBuf[i]); } - // Wait for the bytes to be transmitted - wait (0.00002); - // Skip if the read was to the broadcast address if (_ID != 0xFE) { @@ -373,9 +347,6 @@ plen++; timeout = 0; } - - // wait for the bit period - wait (1.0/_baud); timeout++; } @@ -488,8 +459,6 @@ _ax12.putc(TxBuf[i]); } - // Wait for data to transmit - wait (0.00002); // make sure we have a valid return Status[4]=0x00; @@ -511,9 +480,6 @@ plen++; timeout = 0; } - - // wait for the bit period - wait (1.0/_baud); timeout++; }
--- a/AX12.h Sun Apr 10 21:20:44 2011 +0000 +++ b/AX12.h Wed Oct 18 11:58:25 2017 +0000 @@ -1,36 +1,3 @@ -/* mbed AX-12+ Servo Library - * - * Copyright (c) 2010, cstyles (http://mbed.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef MBED_AX12_H -#define MBED_AX12_H - -#include "mbed.h" - -//#define AX12_WRITE_DEBUG 0 -//#define AX12_READ_DEBUG 0 -//#define AX12_TRIGGER_DEBUG 0 -//#define AX12_DEBUG 0 - #define AX12_REG_ID 0x3 #define AX12_REG_BAUD 0x4 #define AX12_REG_CW_LIMIT 0x06 @@ -48,26 +15,6 @@ #define AX12_CW 1 #define AX12_CCW 0 -/** Servo control class, based on a PwmOut - * - * Example: - * @code - * #include "mbed.h" - * #include "AX12.h" - * - * int main() { - * - * AX12 myax12 (p9, p10, 1); - * - * while (1) { - * myax12.SetGoal(0); // go to 0 degrees - * wait (2.0); - * myax12.SetGoal(300); // go to 300 degrees - * wait (2.0); - * } - * } - * @endcode - */ class AX12 { public: @@ -78,7 +25,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(int tx, int rx, int ID, int baud=1000000); /** Set the mode of the servo * @param mode @@ -179,12 +126,12 @@ int write(int ID, int start, int length, char* data, int flag=0); private : - - SerialHalfDuplex _ax12; + + // SerialHalfDuplex _ax12; int _ID; int _baud; + + +}; -}; - -#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Oct 18 11:58:25 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/0f02307a0877 \ No newline at end of file