Fork van Victor Sluiters library. Output van speed is nu een double i.p.v. float.

Fork of Encoder by First Last

encoder.h

Committer:
vsluiter
Date:
2013-09-25
Revision:
0:c90b36abcbf8
Child:
1:2dd7853c911a

File content as of revision 0:c90b36abcbf8:

#ifndef _ENCODER_H_
#define _ENCODER_H_

#include "mbed.h"

class Encoder
{
    public:
    Encoder(PinName int_a, PinName int_b);
    int32_t getPosition(){return m_position;}
    void    setPosition(int32_t pos){m_position = pos;}
    float   getSpeed(){return m_speed;}
    private:
    void encoderFalling(void);
    void encoderRising(void);
    Timer EncoderTimer;
    Timeout EncoderTimeout;
    InterruptIn pin_a;
    DigitalIn pin_b;
    int32_t m_position;
    float   m_speed;
    void timeouthandler(void);
    bool zero_speed;
};


#endif //_ENCODER_H_