Fork of original mRotaryEncoder library supporting more types of encoders (ones with full rise and fall cycle per one rotations).
Diff: mRotaryEncoder.h
- Revision:
- 11:24b34deae975
- Parent:
- 8:41c44b127443
diff -r 2502b829d452 -r 24b34deae975 mRotaryEncoder.h --- a/mRotaryEncoder.h Fri Feb 26 20:18:57 2016 +0000 +++ b/mRotaryEncoder.h Tue Mar 03 12:20:55 2020 +0000 @@ -34,6 +34,7 @@ * 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 + * Mar2020 Configurable detection of rise/fall events to account for different types of encoders (half as much dent points) * */ class mRotaryEncoder { @@ -45,8 +46,10 @@ * @param pinSW Pin for push-button switch * @param pullmode mode for pinA pinB and pinSW like DigitalIn.mode * @param debounceTime_us time in micro-seconds to wait for bouncing of mechanical switches to end + * @param detectRise Detect rise event as new rotation + * @param detectFall Detect fall event as new rotation */ - mRotaryEncoder(PinName pinA, PinName pinB, PinName pinSW, PinMode pullMode=PullUp, int debounceTime_us=1000); + mRotaryEncoder(PinName pinA, PinName pinB, PinName pinSW, PinMode pullMode=PullUp, int debounceTime_us=1000, int detectRise=1, int detectFall=1); /** destroy object *