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
- Committer:
- bwang
- Date:
- 2016-04-23
- Revision:
- 8:70122bad5f90
- Parent:
- 0:bac9c3a3a6ca
File content as of revision 8:70122bad5f90:
#ifndef POSITIONSENSOR_H
#define POSITIONSENSOR_H
class PositionSensor {
public:
virtual float GetMechPosition() {return 0.0f;}
virtual float GetElecPosition() {return 0.0f;}
virtual int GetRawPosition() {return 0;}
};
class PositionSensorEncoder: public PositionSensor {
public:
PositionSensorEncoder(int CPR, float offset);
virtual float GetMechPosition();
virtual float GetElecPosition();
virtual int GetRawPosition();
private:
InterruptIn *ZPulse;
DigitalIn *ZSense;
DigitalOut *ZTest;
void ZeroEncoderCount(void);
int _CPR;
int state;
float _offset;
};
#endif
