20160814

Fork of CURRENT_CONTROL by LDSC_Robotics_TAs

Revision:
1:c5973a56d474
Parent:
0:955aa05c968a
Child:
2:562bd14dfd3a
--- a/CURRENT_CONTROL.h	Fri Apr 22 09:39:01 2016 +0000
+++ b/CURRENT_CONTROL.h	Fri Apr 22 14:32:01 2016 +0000
@@ -8,27 +8,31 @@
 class CURRENT_CONTROL
 {
 public:
-    
-    void CURRENT_CONTROL(PinName curChannel, PinName PwmChannel1, PinName PwmChannel2, float Kp, float Ki, float Kd, float samplingTime);
-    void ControlCompute(float curRef, float curFeedback);
+    typedef enum {
+        PWM1,
+        PWM2
+    } PWMIndex;
+
+    CURRENT_CONTROL(PinName curChannel, PinName PwmChannel1, PinName PwmChannel2, PWMIndex pwmIndex, float Kp, float Ki, float Kd, float samplingTime);
+    void Control(float curRef);
     void ChangePwmPeriod(float microSeconds);
-    
-    typedef enum {
-        PWM1;
-        PWM2;
-    } PWMIndex;
-    
+    void SetAnalog2Cur(float ratio);
+    void SetPWMDuty(float ratio);
+
+    PWMIndex pwmIndex_;
     PID pid;
     PwmOut MotorPlus;
     PwmOut MotorMinus;
     float controlOutput;
 
     float currentOffset;
-    float currentFeedBack;
+    float curFeedBack;
+    float analog2Cur;
+    AnalogIn currentAnalogIn;
 private:
 
     float Ts;
-    AnalogIn currentAnalogIn;
+    
 
 };