Class mRotaryEncoder for mechanical incremental rotary encoders with pushbuttons. Use debouncing and callback-functions for rotation and pressing of button.

Dependencies:   PinDetect

Dependents:   accuBlast_display

Files at this revision

API Documentation at this revision

Comitter:
BETZtechnik
Date:
Fri Mar 29 06:13:48 2019 +0000
Parent:
10:2502b829d452
Commit message:
Ready for release ;

Changed in this revision

mRotaryEncoder.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 2502b829d452 -r 20ad86601057 mRotaryEncoder.cpp
--- a/mRotaryEncoder.cpp	Fri Feb 26 20:18:57 2016 +0000
+++ b/mRotaryEncoder.cpp	Fri Mar 29 06:13:48 2019 +0000
@@ -51,10 +51,10 @@
     //pinA still low?
     if (*m_pinA == 0) {
         if (*m_pinB == 1) {
-            m_position++;
+            m_position--;
             rotCWIsr.call();
         } else {
-            m_position--;
+            m_position++;
             rotCCWIsr.call();
         }
     rotIsr.call();                        // call the isr for rotation
@@ -66,10 +66,10 @@
     //pinA still high?
     if (*m_pinA == 1) {
         if (*m_pinB == 1) {
-            m_position--;
+           // m_position--;   //PB to make it behave once per detent.
             rotCCWIsr.call();
         } else {
-            m_position++;
+         //   m_position++;    //PB
             rotCWIsr.call();
         }
     rotIsr.call();                        // call the isr for rotation