Class mRotaryEncoder for mechanical incremental rotary encoders with pushbuttons. Use debouncing and callback-functions for rotation and pressing of button. This version is for old mbed. New version for mbed-os see https://os.mbed.com/users/charly/code/mRotaryEncoder-os/

Dependencies:   PinDetect

Dependents:   SimplePIDBot FinalProgram VS1053Player SPK-DVIMXR ... more

Revision:
2:f99ac9745a2c
Parent:
1:bb7b4e631dff
Child:
3:39c2fc4482be
--- a/mRotaryEncoder.h	Mon Nov 29 21:38:17 2010 +0000
+++ b/mRotaryEncoder.h	Tue Feb 01 19:43:46 2011 +0000
@@ -2,6 +2,7 @@
 #define MROTENC_H_INCLUDED
 
 #include "mbed.h"
+#include "PinDetect.h"
 
 
 /** This Class handles a rotary encoder with mechanical switches and an integrated pushbutton
@@ -77,7 +78,7 @@
     * @param fptr Pointer to callback-function
     */
     void attachSW(void (*fptr)(void)) {
-        m_pinSW->fall(fptr);
+        m_pinSW->attach_asserted(fptr);
     }
 
     template<typename T>
@@ -125,7 +126,8 @@
 
     int             m_debounceTime_us;
 
-    InterruptIn     *m_pinSW;
+    //InterruptIn     *m_pinSW;
+    PinDetect       *m_pinSW;
 
     void rise(void);
     void fall(void);