Debugged library

Dependents:   MX106-finaltest dynamixel Arm_dynamixel_can Arm_dynamixel_can_procedurale

Fork of AX12_v2 by Team DIANA

Revision:
14:4487db847117
Parent:
8:ae950cba6bc9
Child:
15:8112cd01501f
--- a/AX12.h	Sun Jun 26 21:14:17 2016 +0000
+++ b/AX12.h	Wed Jul 13 15:52:28 2016 +0000
@@ -26,6 +26,7 @@
 
 #include "mbed.h"
 #include "SerialHalfDuplex.h"
+#include "MX.h"
 #define AX12_WRITE_DEBUG 1
 #define AX12_READ_DEBUG 1
 #define AX12_TRIGGER_DEBUG 1
@@ -67,106 +68,14 @@
  * }
  * @endcode
  */
-class AX12 {
+class AX12 : public MX {
 
 public:
 
-    /** Create an AX12 servo object connected to the specified serial port, with the specified ID
-     *
-     * @param pin tx pin
-     * @param pin rx pin 
-     * @param int ID, the Bus ID of the servo 1-255 
-     */
-    AX12(PinName tx, PinName rx, int ID);
-
-    /** Set the mode of the servo
-     * @param mode
-     *    0 = Positional, default
-     *    1 = Continuous rotation
-     */
-    int SetMode(int mode);
-
-    /** Set goal angle in integer degrees, in positional mode
-     *
-     * @param degrees 0-300
-     * @param flags, defaults to 0
-     *    flags[0] = blocking, return when goal position reached 
-     *    flags[1] = register, activate with a broadcast trigger
-     *
-     */
-    int SetGoal(int degrees, int flags = 0);
-
-
-    /** Set the speed of the servo in continuous rotation mode
-     *
-     * @param speed, -1.0 to 1.0
-     *   -1.0 = full speed counter clock wise
-     *    1.0 = full speed clock wise
-     */
-    int SetCRSpeed(float speed);
-
-
-    /** Set the clockwise limit of the servo
-     *
-     * @param degrees, 0-300
-     */
-    int SetCWLimit(int degrees);
-    
-    /** Set the counter-clockwise limit of the servo
-     *
-     * @param degrees, 0-300
-     */
-    int SetCCWLimit(int degrees);
-
-    // Change the ID
-
-    /** Change the ID of a servo
-     *
-     * @param CurentID 1-255
-     * @param NewID 1-255
-     *
-     * If a servo ID is not know, the broadcast address of 0 can be used for CurrentID.
-     * In this situation, only one servo should be connected to the bus
-     */
-    int SetID(int CurrentID, int NewID);
-
-
-    /** Poll to see if the servo is moving
-     *
-     * @returns true is the servo is moving
-     */
-    int isMoving(void);
-
-    /** Send the broadcast "trigger" command, to activate any outstanding registered commands
-     */
-    void trigger(void);
-
-    /** Read the current angle of the servo
-     *
-     * @returns float in the range 0.0-300.0
-     */
-    float GetPosition();
-
-    /** Read the temperature of the servo
-     *
-     * @returns float temperature 
-     */
-    float GetTemp(void);
-
-    /** Read the supply voltage of the servo
-     *
-     * @returns float voltage
-     */
-    float GetVolts(void);
-
-private :
-
-    SerialHalfDuplex _ax12;
-    int _ID;
-
-    int read(int ID, int start, int length, char* data);
-    int write(int ID, int start, int length, char* data, int flag=0);
+    AX12(communication_1& line, int ID, float gear_train);
+    virtual void setMode(int mode);
 
 };
 
 #endif
+