Dyanamixel

Dependents:   YOZAKURA_ARM YOZAKURA_ARM_USB YOZAKURA_ARM_USB_Keyboard YOZAKURA_ARM_Keyboard0424 ... more

Revision:
1:3ac0919c093f
Parent:
0:10c9fb86002f
Child:
2:08072af3e9da
--- a/MX28.h	Tue Mar 31 09:45:27 2015 +0000
+++ b/MX28.h	Wed Apr 08 08:03:42 2015 +0000
@@ -25,7 +25,7 @@
 #define MBED_MX28_H
 
 #include "mbed.h"
-#include "SerialHalfDuplex.h"
+//#include "SerialHalfDuplex.h"
 
 #define MX28_WRITE_DEBUG 0
 #define MX28_READ_DEBUG 0
@@ -35,12 +35,14 @@
 #define MX28_REG_ID 0x3
 #define MX28_REG_CW_LIMIT 0x06
 #define MX28_REG_CCW_LIMIT 0x08
+#define MX28_REG_TORQUE_ENABLE 0x18
 #define MX28_REG_GOAL_POSITION 0x1E
 #define MX28_REG_MOVING_SPEED 0x20
 #define MX28_REG_VOLTS 0x2A
 #define MX28_REG_TEMP 0x2B
 #define MX28_REG_MOVING 0x2E
 #define MX28_REG_POSITION 0x24
+#define MX28_REG_TORQUE_LIMIT 0x22
 #define MX28_REG_CURRENT 0x44
 
 #define MX28_MODE_POSITION  0
@@ -49,15 +51,16 @@
 #define MX28_CW 1
 #define MX28_CCW 0
 
-class MX28 {
+class MX28
+{
 
 public:
 
     /** Create an MX28 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 
+     * @param pin rx pin
+     * @param int ID, the Bus ID of the servo 1-255
      */
     MX28(PinName tx, PinName rx, int ID);
 
@@ -72,7 +75,7 @@
      *
      * @param degrees 0-360
      * @param flags, defaults to 0
-     *    flags[0] = blocking, return when goal position reached 
+     *    flags[0] = blocking, return when goal position reached
      *    flags[1] = register, activate with a broadcast trigger
      *
      */
@@ -93,7 +96,7 @@
      * @param degrees, 0-360
      */
     int SetCWLimit(int degrees);
-    
+
     /** Set the counter-clockwise limit of the servo
      *
      * @param degrees, 0-360
@@ -131,7 +134,7 @@
 
     /** Read the temperature of the servo
      *
-     * @returns float temperature 
+     * @returns float temperature
      */
     float GetTemp(void);
 
@@ -140,16 +143,21 @@
      * @returns float voltage
      */
     float GetVolts(void);
-    
+
     /** Read the supply current of the servo
      *
      * @returns float current
      */
     float GetCurrent(void);
 
+    int TorqueEnable(int mode);
+
+    int SetTorqueLimit(float torque_limit);
+
 private :
 
-    SerialHalfDuplex _mx28;
+//    SerialHalfDuplex _mx28;
+    Serial _mx28;
     int _ID;
 
     int read(int ID, int start, int length, char* data);