C++ class for controlling DC motor with encoder feedback. Dependencies include LS7366LIB, MotCon, and PID.

Dependencies:   LS7366LIB MotCon2 PID

Dependents:   LPC1768_6axis_Arm

Revision:
2:653433f4ee72
Parent:
1:cd249816dba8
Child:
5:79dcaa63700c
--- a/Axis.h	Thu Sep 24 16:47:02 2015 +0000
+++ b/Axis.h	Wed Sep 30 16:20:45 2015 +0000
@@ -10,13 +10,15 @@
 
 class Axis{
 public:
-    Axis(SPI& _spi, PinName _cs, PinName _pwm, PinName _dir, int* limit);    
+    Axis(SPI& _spi, PinName _cs, PinName _pwm, PinName _dir, PinName _analog, int* limit, float totalCnts);    
     void paramUpdate(void);
-    void home(long halfcounts);
-    void init(float);
-    void setSetPoint(float);
+    void center(void);
+    void init(void);
     void moveTrapezoid(float position, float time);
     void moveUpdate(void);
+    float readCurrent(void);
+    void axisOff(void);
+    void axisOn(void);
     
     long enc;
     float co;// = 0.0;
@@ -37,8 +39,9 @@
     int moveState;
     int debug;
     int *ptr_limit;
-    
-    float countsPerDeg;        //number of counts/revolution
+    float totalCounts;
+    float motCurrent;
+    int axisState;
 
     Ticker update;
     Ticker moveProfile;
@@ -46,12 +49,14 @@
     PID *pid;
     LS7366 *ls7366;
     MotCon *motcon;
+    //AnalogIn *motCurrent;
     
 private:
     SPI _spi;
     DigitalOut _cs;
     PwmOut _pwm;
-    DigitalOut _dir;    
+    DigitalOut _dir;
+    AnalogIn _analog;
 };
 
 #endif