BE@R lab / motion_control

Dependencies:   motor_relay

Dependents:   dog_V3_3_testmotor

Revision:
3:4fa191f2194d
Parent:
1:5b313fd2ca6f
Child:
4:6509fec6a6fb
--- a/motion_control.cpp	Fri Jul 17 14:32:19 2015 +0000
+++ b/motion_control.cpp	Fri Jul 17 15:35:09 2015 +0000
@@ -3,7 +3,7 @@
 #include "motor_relay.h"
 
 //int16_t MOTION_CONTROL::error=0;
-//int16_t MOTION_CONTROL::MARGIN=500;
+//int16_t MARGIN;
 
 
 MOTION_CONTROL::MOTION_CONTROL(PinName dirA, PinName dirB, PinName limitUp, PinName limitDown, PinName vr): _limit_up(limitUp), _limit_down(limitDown), _position(vr)
@@ -35,7 +35,7 @@
     error = target-current;
     if(error >scale || error < -scale) {
         //pc.printf("data error\n");
-        
+
     } else {
         if(error > MARGIN) {
             if(limit_motor(1)==0 ) { //limit sens
@@ -100,4 +100,33 @@
     MIN_POSITION = _position.read_u16();
     //pc.printf("min_pos_LU= %d\n",min_pos_LU);
 
-}
\ No newline at end of file
+}
+
+int MOTION_CONTROL::GetLimitUp()
+{
+    return _limit_up;
+}
+
+int MOTION_CONTROL::GetLimitDown()
+{
+    return _limit_down;
+}
+
+void MOTION_CONTROL::SetMargin(int16_t data)
+{
+    MARGIN = data;
+}
+int16_t MOTION_CONTROL::GetMargin()
+{
+    return MARGIN;
+}
+
+uint16_t MOTION_CONTROL::GetMaxPosition()
+{
+    return MAX_POSITION;
+}
+
+uint16_t MOTION_CONTROL::GetMinPosition()
+{
+    return MIN_POSITION;
+}