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.
Fork of foc-ed_in_the_bot_compact by
PositionSensor/PositionSensor.h@8:70122bad5f90, 2016-04-23 (annotated)
- Committer:
- bwang
- Date:
- Sat Apr 23 21:29:32 2016 +0000
- Revision:
- 8:70122bad5f90
- Parent:
- 0:bac9c3a3a6ca
foc'ed in the bot
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| bwang | 0:bac9c3a3a6ca | 1 | #ifndef POSITIONSENSOR_H |
| bwang | 0:bac9c3a3a6ca | 2 | #define POSITIONSENSOR_H |
| bwang | 0:bac9c3a3a6ca | 3 | |
| bwang | 0:bac9c3a3a6ca | 4 | class PositionSensor { |
| bwang | 0:bac9c3a3a6ca | 5 | public: |
| bwang | 0:bac9c3a3a6ca | 6 | virtual float GetMechPosition() {return 0.0f;} |
| bwang | 0:bac9c3a3a6ca | 7 | virtual float GetElecPosition() {return 0.0f;} |
| bwang | 8:70122bad5f90 | 8 | virtual int GetRawPosition() {return 0;} |
| bwang | 0:bac9c3a3a6ca | 9 | }; |
| bwang | 0:bac9c3a3a6ca | 10 | |
| bwang | 0:bac9c3a3a6ca | 11 | |
| bwang | 0:bac9c3a3a6ca | 12 | class PositionSensorEncoder: public PositionSensor { |
| bwang | 0:bac9c3a3a6ca | 13 | public: |
| bwang | 0:bac9c3a3a6ca | 14 | PositionSensorEncoder(int CPR, float offset); |
| bwang | 0:bac9c3a3a6ca | 15 | virtual float GetMechPosition(); |
| bwang | 0:bac9c3a3a6ca | 16 | virtual float GetElecPosition(); |
| bwang | 8:70122bad5f90 | 17 | virtual int GetRawPosition(); |
| bwang | 0:bac9c3a3a6ca | 18 | private: |
| bwang | 0:bac9c3a3a6ca | 19 | InterruptIn *ZPulse; |
| bwang | 0:bac9c3a3a6ca | 20 | DigitalIn *ZSense; |
| bwang | 0:bac9c3a3a6ca | 21 | DigitalOut *ZTest; |
| bwang | 0:bac9c3a3a6ca | 22 | void ZeroEncoderCount(void); |
| bwang | 0:bac9c3a3a6ca | 23 | int _CPR; |
| bwang | 0:bac9c3a3a6ca | 24 | int state; |
| bwang | 0:bac9c3a3a6ca | 25 | float _offset; |
| bwang | 0:bac9c3a3a6ca | 26 | }; |
| bwang | 0:bac9c3a3a6ca | 27 | |
| bwang | 0:bac9c3a3a6ca | 28 | #endif |
