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

Fork of Encoder by First Last

Committer:
vsluiter
Date:
Wed Sep 25 14:55:08 2013 +0000
Revision:
0:c90b36abcbf8
Child:
1:2dd7853c911a
Initial Commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vsluiter 0:c90b36abcbf8 1 #ifndef _ENCODER_H_
vsluiter 0:c90b36abcbf8 2 #define _ENCODER_H_
vsluiter 0:c90b36abcbf8 3
vsluiter 0:c90b36abcbf8 4 #include "mbed.h"
vsluiter 0:c90b36abcbf8 5
vsluiter 0:c90b36abcbf8 6 class Encoder
vsluiter 0:c90b36abcbf8 7 {
vsluiter 0:c90b36abcbf8 8 public:
vsluiter 0:c90b36abcbf8 9 Encoder(PinName int_a, PinName int_b);
vsluiter 0:c90b36abcbf8 10 int32_t getPosition(){return m_position;}
vsluiter 0:c90b36abcbf8 11 void setPosition(int32_t pos){m_position = pos;}
vsluiter 0:c90b36abcbf8 12 float getSpeed(){return m_speed;}
vsluiter 0:c90b36abcbf8 13 private:
vsluiter 0:c90b36abcbf8 14 void encoderFalling(void);
vsluiter 0:c90b36abcbf8 15 void encoderRising(void);
vsluiter 0:c90b36abcbf8 16 Timer EncoderTimer;
vsluiter 0:c90b36abcbf8 17 Timeout EncoderTimeout;
vsluiter 0:c90b36abcbf8 18 InterruptIn pin_a;
vsluiter 0:c90b36abcbf8 19 DigitalIn pin_b;
vsluiter 0:c90b36abcbf8 20 int32_t m_position;
vsluiter 0:c90b36abcbf8 21 float m_speed;
vsluiter 0:c90b36abcbf8 22 void timeouthandler(void);
vsluiter 0:c90b36abcbf8 23 bool zero_speed;
vsluiter 0:c90b36abcbf8 24 };
vsluiter 0:c90b36abcbf8 25
vsluiter 0:c90b36abcbf8 26
vsluiter 0:c90b36abcbf8 27 #endif //_ENCODER_H_