Fork of mRotaryEncoder for mdeb-os. uses newer version of PinDetect. Testprogram: https://os.mbed.com/users/charly/code/mRotaryEncoder_HelloWorld-os/
Dependents: mRotaryEncoder_HelloWorld-os TMC2209-Test2
Revision 2:f99ac9745a2c, committed 2011-02-01
- Comitter:
- charly
- Date:
- Tue Feb 01 19:43:46 2011 +0000
- Parent:
- 1:bb7b4e631dff
- Child:
- 3:39c2fc4482be
- Commit message:
- Changed InterruptIn for switch to PinDetect
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PinDetect.lib Tue Feb 01 19:43:46 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/AjK/code/PinDetect/#cb3afc45028b
--- a/mRotaryEncoder.cpp Mon Nov 29 21:38:17 2010 +0000
+++ b/mRotaryEncoder.cpp Tue Feb 01 19:43:46 2011 +0000
@@ -15,8 +15,11 @@
m_pinA->fall(this, &mRotaryEncoder::fall);
// Switch on pinSW
- m_pinSW = new InterruptIn(pinSW); // interrupt on press switch
+ m_pinSW = new PinDetect(pinSW); // interrupt on press switch
m_pinSW->mode(pullMode);
+
+ m_pinSW->setSampleFrequency(); // Defaults to 20ms.
+
m_position = 0;
--- 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);