The function library of serial servo controller

Dependents:   DR-ArmServoTest ros_button_2021 DR-ArmServoTest

Revision:
0:3b51e0118f2b
Child:
1:1398d9ddd4ef
diff -r 000000000000 -r 3b51e0118f2b LSCServo.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LSCServo.h	Wed May 19 09:51:20 2021 +0000
@@ -0,0 +1,29 @@
+#ifndef LSC_SERVO
+#define LSC_SERVO
+//from mbed
+#include "mbed.h"
+//from ros
+#include "BufferedSerial.h"
+
+#include <vector>
+
+#define LOBOT_SERVO_FRAME_HEADER         0x55
+#define LOBOT_SERVO_MOVE_TIME_WRITE      1
+
+using namespace std;
+
+
+class LSCServo {
+    private:
+        BufferedSerial serial;
+    public:
+        LSCServo(PinName tx, PinName rx, uint32_t buf_size = 256, uint32_t tx_multiple = 4,const char* name=NULL);
+        virtual ~LSCServo();
+        void LobotSerialoneServoMove(uint16_t id, int16_t position, uint16_t time);  //control one serial servo move dedicated position
+        void LobotSerialServoMove(vector<uint16_t> id, vector<int16_t> position, uint16_t time);  //control list of serial servo move dedicated position
+        void LobotSerialActionGroupRun(uint16_t id, uint16_t count);//Run Action Group in multiple time, 0 == infinity
+        void LobotSerialActionGroupSpeed(uint16_t id, uint16_t speed);//Set Run speed Action Group in XXX%, 0xFF for all
+        int LobotSerialGetBatteryVoltage();//get voltage of board in terms of mV
+        void LobotSerialActionGroupStop();//Stop current action group
+};
+#endif
\ No newline at end of file