2018 HongoMechaTech A

Dependencies:   mbed

lib/QEI.h

Committer:
Komazawa_sun
Date:
2018-09-18
Revision:
0:e83b840a5f86

File content as of revision 0:e83b840a5f86:

#ifndef MBED_QEI
#define MBED_QEI
#include "mbed.h"
#include "Angle.h"

class QEI : public Angle{
public:
    QEI(PinName A, PinName B, int pulses, float t);
    virtual double read();
    virtual void reset();
    void RevorutionCounter();
    float over_angle();
    int over_count();
    int count();
    int revolution();
    float angle();
    float acceleration();
    float speed();
protected:
    int pulses_;   
private:
    Ticker x_;
    InterruptIn A_, B_;
    int count_;
    int over_count_;
    int32_t oldcount_;
    int revolutions_;
    float speed_;
    float oldspeed_;
    float acceleration_;
    float t_;
    
    void _AR();
    void _AF();
    void _BR();
    void _BF();
    void _sa();
};

#endif