hh
Diff: PositionSensor/PositionSensor.h
- Revision:
- 9:d7eb815cb057
- Parent:
- 8:10ae7bc88d6e
- Child:
- 10:370851e6e132
diff -r 10ae7bc88d6e -r d7eb815cb057 PositionSensor/PositionSensor.h --- a/PositionSensor/PositionSensor.h Wed Apr 13 04:09:56 2016 +0000 +++ b/PositionSensor/PositionSensor.h Tue May 10 01:15:57 2016 +0000 @@ -4,6 +4,7 @@ public: virtual float GetMechPosition() {return 0.0f;} virtual float GetElecPosition() {return 0.0f;} + virtual float GetMechVelocity() {return 0.0f;} }; @@ -22,7 +23,7 @@ virtual void ZeroEncoderCountDown(void); int _CPR, flag, rotations; //int state; - float _offset, MechPosition, dir, test_pos; + float _offset, MechPosition, dir, test_pos, vel_old, out_old; }; class PositionSensorSPI: public PositionSensor{ @@ -30,8 +31,10 @@ PositionSensorSPI(int CPR, float offset); virtual float GetMechPosition(); virtual float GetElecPosition(); + virtual float GetMechVelocity(); + virtual void ZeroPosition(); private: - float _offset, MechPosition; + float _offset, MechPosition, MechOffset; int _CPR, rotations, old_counts; SPI *spi; DigitalOut *cs;