Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: PositionSensor/PositionSensor.h
- Revision:
- 9:d7eb815cb057
- Parent:
- 8:10ae7bc88d6e
- Child:
- 10:370851e6e132
--- 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;