2018 HongoMechaTech A

Dependencies:   mbed

Revision:
0:e83b840a5f86
diff -r 000000000000 -r e83b840a5f86 lib/QEI.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/QEI.h	Tue Sep 18 03:11:01 2018 +0000
@@ -0,0 +1,40 @@
+#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