Equator Strut Controller

Dependents:   EquatorStrutDigitalMonitor

Committer:
pyrostew
Date:
Wed Aug 20 08:34:59 2014 +0000
Revision:
2:3976e3f43470
Parent:
0:a6ade00ff41d
Updated library to latest code used in Alpeshs' project.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pyrostew 0:a6ade00ff41d 1 #ifndef EQUATOR_STRUT_CONTROLLER_H
pyrostew 0:a6ade00ff41d 2 #define EQUATOR_STRUT_CONTROLLER_H
pyrostew 0:a6ade00ff41d 3
pyrostew 0:a6ade00ff41d 4 #include "mbed.h"
pyrostew 0:a6ade00ff41d 5
pyrostew 0:a6ade00ff41d 6 class EquatorStrut
pyrostew 0:a6ade00ff41d 7 {
pyrostew 0:a6ade00ff41d 8 public:
pyrostew 0:a6ade00ff41d 9 EquatorStrut();
pyrostew 0:a6ade00ff41d 10 void SetPower(double power);
pyrostew 0:a6ade00ff41d 11 double GetPosition();
pyrostew 0:a6ade00ff41d 12 double CurrentSpeed();
pyrostew 2:3976e3f43470 13 double CurrentPower();
pyrostew 0:a6ade00ff41d 14 void Home();
pyrostew 0:a6ade00ff41d 15 void Enable();
pyrostew 0:a6ade00ff41d 16 void Disable();
pyrostew 2:3976e3f43470 17 bool IsEnabled();
pyrostew 0:a6ade00ff41d 18
pyrostew 0:a6ade00ff41d 19 private:
pyrostew 2:3976e3f43470 20 DigitalIn* HallSensorState;
pyrostew 2:3976e3f43470 21 InterruptIn* RGHSinInterrupt;
pyrostew 2:3976e3f43470 22 InterruptIn* RGHCosInterrupt;
pyrostew 2:3976e3f43470 23 InterruptIn* RGHSinFallingInterrupt;
pyrostew 2:3976e3f43470 24 InterruptIn* RGHCosFallingInterrupt;
pyrostew 0:a6ade00ff41d 25 InterruptIn* HallSensor;
pyrostew 2:3976e3f43470 26 DigitalOut* ResetLine;
pyrostew 0:a6ade00ff41d 27 PwmOut* PhaseA;
pyrostew 0:a6ade00ff41d 28 PwmOut* PhaseB;
pyrostew 2:3976e3f43470 29 Timer* RunningTime;
pyrostew 0:a6ade00ff41d 30
pyrostew 2:3976e3f43470 31 void RGHSinRisingHandler();
pyrostew 2:3976e3f43470 32 void RGHCosRisingHandler();
pyrostew 2:3976e3f43470 33 void RGHSinFallingHandler();
pyrostew 2:3976e3f43470 34 void RGHCosFallingHandler();
pyrostew 2:3976e3f43470 35 void ActionEvent(bool currHigh, bool currSin);
pyrostew 0:a6ade00ff41d 36
pyrostew 2:3976e3f43470 37 void DisableInterrupts();
pyrostew 2:3976e3f43470 38 void EnableInterrupts();
pyrostew 2:3976e3f43470 39
pyrostew 0:a6ade00ff41d 40 void HallEffectFall();
pyrostew 0:a6ade00ff41d 41
pyrostew 2:3976e3f43470 42 volatile int position;
pyrostew 2:3976e3f43470 43 volatile int direction;
pyrostew 0:a6ade00ff41d 44
pyrostew 2:3976e3f43470 45 volatile double currentPower;
pyrostew 0:a6ade00ff41d 46
pyrostew 2:3976e3f43470 47 volatile bool Homing;
pyrostew 2:3976e3f43470 48 volatile bool HallTriggered;
pyrostew 2:3976e3f43470 49 volatile bool Enabled;
pyrostew 0:a6ade00ff41d 50
pyrostew 2:3976e3f43470 51 double SpeedInterval;
pyrostew 2:3976e3f43470 52 int LastPosition;
pyrostew 2:3976e3f43470 53
pyrostew 2:3976e3f43470 54 volatile bool SinHigh;
pyrostew 2:3976e3f43470 55 volatile bool CosHigh;
pyrostew 2:3976e3f43470 56 volatile bool LastSin;
pyrostew 2:3976e3f43470 57 volatile bool LastHigh;
pyrostew 0:a6ade00ff41d 58 };
pyrostew 0:a6ade00ff41d 59
pyrostew 0:a6ade00ff41d 60 #endif