Librairie pour contrôler un moteur connecté à un contrôleur SDC21XX

Dependencies:   CANopen_Node Roboteq_SDC_serie

Dependents:   TCP_Server_Example

Fork of SDC21XX_Motor by Pierre David

Revision:
0:1c0bc44980e0
Child:
1:a677037eca0a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDC21XX_Motor.cpp	Wed Jun 01 15:03:34 2016 +0000
@@ -0,0 +1,61 @@
+#include "SDC21XX_Motor.h"
+
+
+namespace mbed {
+    
+    SDC21XX_Motor::SDC21XX_Motor(uint8_t _node_id, CAN * _can, uint8_t _channel, uint32_t _reductor): channel(_channel), reductor(_reductor), RB(_node_id, _can)
+    {
+        
+    }
+    void SDC21XX_Motor::GoAngle(int16_t _angle)
+    {
+        RB.SetPosition(_angle*1024/360*reductor, channel);
+    }
+    
+    int16_t SDC21XX_Motor::GetAngle()
+    {
+        return RB.ReadAbsoluteEncoderCount(channel);
+    }
+    
+    void SDC21XX_Motor::SetChannel(uint8_t _channel)
+    {
+        channel = _channel;
+    }
+    
+    uint8_t SDC21XX_Motor::GetChannel(void)
+    {
+        return channel;
+    }
+    
+    void SDC21XX_Motor::SetReductor(uint32_t _reductor)
+    {
+        reductor = _reductor;
+    }
+    
+    uint32_t SDC21XX_Motor::GetReductor(void)
+    {
+        return reductor;
+    }
+    
+    void SDC21XX_Motor::SetNodeID(uint8_t _node_id)
+    {
+        RB.SetNodeID(_node_id);
+    }
+    
+    uint8_t SDC21XX_Motor::GetNodeID(void)
+    {
+        return RB.GetNodeID();
+    }
+    
+    void SDC21XX_Motor::SetCan(CAN * _can)
+    {
+        RB.SetCan(_can);
+    }
+    
+    CAN* SDC21XX_Motor::GetCan(void)
+    {
+        return RB.GetCan();
+    }
+
+    
+}//end namespace
\ No newline at end of file