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
Revision 3:39c2fc4482be, committed 2011-02-01
- Comitter:
- charly
- Date:
- Tue Feb 01 19:54:35 2011 +0000
- Parent:
- 2:f99ac9745a2c
- Child:
- 4:82be633acd05
- Commit message:
- Updated PinDetect functions
Changed in this revision
--- a/PinDetect.lib Tue Feb 01 19:43:46 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/AjK/code/PinDetect/#cb3afc45028b
--- a/mRotaryEncoder.cpp Tue Feb 01 19:43:46 2011 +0000 +++ b/mRotaryEncoder.cpp Tue Feb 01 19:54:35 2011 +0000 @@ -18,7 +18,7 @@ m_pinSW = new PinDetect(pinSW); // interrupt on press switch m_pinSW->mode(pullMode); - m_pinSW->setSampleFrequency(); // Defaults to 20ms. + m_pinSW->setSampleFrequency(debounceTime_us); // Start timers an Defaults debounce time. m_position = 0;
--- a/mRotaryEncoder.h Tue Feb 01 19:43:46 2011 +0000 +++ b/mRotaryEncoder.h Tue Feb 01 19:54:35 2011 +0000 @@ -78,7 +78,7 @@ * @param fptr Pointer to callback-function */ void attachSW(void (*fptr)(void)) { - m_pinSW->attach_asserted(fptr); + m_pinSW->attach_deasserted(fptr); } template<typename T> @@ -90,7 +90,7 @@ */ void attachSW(T* tptr, void (T::*mptr)(void)) { if ((mptr != NULL) && (tptr != NULL)) { - m_pinSW->fall(tptr, mptr); + m_pinSW->attach_deasserted(tptr, mptr); } }