Equator Strut Controller

Dependents:   EquatorStrutDigitalMonitor

Revision:
2:3976e3f43470
Parent:
0:a6ade00ff41d
--- a/EquatorStrutController.h	Tue Jul 29 11:12:10 2014 +0000
+++ b/EquatorStrutController.h	Wed Aug 20 08:34:59 2014 +0000
@@ -10,43 +10,51 @@
     void SetPower(double power);
     double GetPosition();
     double CurrentSpeed();
+    double CurrentPower();
     void Home();
     void Enable();
     void Disable();
+    bool IsEnabled();
     
 private:
-    Timer SinInterruptInterval;
-    Ticker InputReadTick;
-    
+    DigitalIn* HallSensorState;
+    InterruptIn* RGHSinInterrupt;
+    InterruptIn* RGHCosInterrupt;
+    InterruptIn* RGHSinFallingInterrupt;
+    InterruptIn* RGHCosFallingInterrupt;
     InterruptIn* HallSensor;
-    
+    DigitalOut* ResetLine;
     PwmOut* PhaseA;
     PwmOut* PhaseB;
-    
-    DigitalIn* RGHSin;
-    DigitalIn* RGHCos;
+    Timer* RunningTime;
     
-    DigitalOut* ResetLine;
-    DigitalOut* PulseOut1;
-    DigitalOut* PulseOut2;
-      
-    bool Valid();
+    void RGHSinRisingHandler();
+    void RGHCosRisingHandler();
+    void RGHSinFallingHandler();
+    void RGHCosFallingHandler();
+    void ActionEvent(bool currHigh, bool currSin);
     
-    void InputRead();
+    void DisableInterrupts();
+    void EnableInterrupts();
+    
     void HallEffectFall();
     
-    char PinState;
+    volatile int position;
+    volatile int direction;
     
-    int FullWavePeriod;
-    int PartWavePeriod;
+    volatile double currentPower;
     
-    double position;
-    
-    int direction;
+    volatile bool Homing;
+    volatile bool HallTriggered;
+    volatile bool Enabled;
     
-    bool Homing;
-    bool HallTriggered;
-    bool Enabled;
+    double SpeedInterval;
+    int LastPosition;
+    
+    volatile bool SinHigh;
+    volatile bool CosHigh;
+    volatile bool LastSin;
+    volatile bool LastHigh;
 };
 
 #endif
\ No newline at end of file