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/
Dependents: SimplePIDBot FinalProgram VS1053Player SPK-DVIMXR ... more
Diff: mRotaryEncoder.h
- Revision:
- 5:75ddffaf3721
- Parent:
- 3:39c2fc4482be
- Child:
- 6:854c349157b0
--- a/mRotaryEncoder.h Tue Feb 01 20:06:48 2011 +0000 +++ b/mRotaryEncoder.h Wed Feb 09 20:18:34 2011 +0000 @@ -33,6 +33,7 @@ * 09. Nov. 2010 * First version published Thomas Raab raabinator * 26.11.2010 extended by charly - pushbutton, pullmode, debounce, callback-system + * Feb2011 Changes InterruptIn to PinDetect which does the debounce of mechanical switches * */ class mRotaryEncoder { @@ -120,13 +121,13 @@ private: - InterruptIn *m_pinA; + PinDetect *m_pinA; DigitalIn *m_pinB; volatile int m_position; int m_debounceTime_us; - //InterruptIn *m_pinSW; + PinDetect *m_pinSW; void rise(void);