Library for manual Encoders as used in user interfaces. Very simple, reduced and rock solid encoder library. Counts full pulses only. Inherent debouncing through state machine. Running on a regular timer IRQ. No IRQ jamming through bouncing. Immune to false edges giving unwanted counts when moving partial steps. Not depending on PinDetect or anything else. May be enhanced by adding acceleration and push button debouncing in the future.

Library for manual Encoders as used in user interfaces. Very simple, reduced and rock solid. Counts full pulses/steps only. Inherent debouncing through state machine. No time dependency for debouncing. Very tight code running in a regular timer IRQ. No IRQ jamming through bouncing edges. Immune to false edges giving unwanted counts when moving partial steps back and forth. Not depending on PinDetect or any other debouncing library. May be enhanced in the near future by adding acceleration and push button debouncing.

Revision:
2:603b47d3755e
Child:
4:ee384561bfa4
diff -r 158a3886aced -r 603b47d3755e EncoderConfig.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EncoderConfig.h	Tue Nov 25 09:33:56 2014 +0000
@@ -0,0 +1,41 @@
+// Encoder lib for user interfaces
+// Use this file for configuring the pins, timings etc.
+/*
+The MIT License (MIT)
+
+Copyright (c) 2014 calima engineering
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#ifndef ENCODER_CONFIG_H_
+#define ENCODER_CONFIG_H_
+
+// Chose encoder pins
+#define ENCODER_PIN_A D6
+#define ENCODER_PIN_B D7
+
+// Sample every ... microseconds, default
+// 250µs is a good value for cheap 24 ppr encoders (ALPS EC12E24...) with strong bouncing.
+// 1000µs is a good value for quality 24 ppr encoders (ALPS EC12E24...) with low bouncing.
+// 250µs is a good value for fast 24+ ppr encoders (Sparkfun, Qubig Panel1 type...).
+#define ENCODER_SAMPLE_PERIOD_US (250)
+
+
+#endif // ENCODER_CONFIG_H_
\ No newline at end of file