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.

Committer:
eduardoG26
Date:
Fri Jan 16 15:33:21 2015 +0000
Revision:
5:70534b19d8bf
Parent:
2:603b47d3755e
Pushbutton Debouncing added.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
eduardoG26 2:603b47d3755e 1 /*
eduardoG26 2:603b47d3755e 2 The MIT License (MIT)
eduardoG26 2:603b47d3755e 3
eduardoG26 2:603b47d3755e 4 Copyright (c) 2014 calima engineering
eduardoG26 2:603b47d3755e 5
eduardoG26 2:603b47d3755e 6 Permission is hereby granted, free of charge, to any person obtaining a copy
eduardoG26 2:603b47d3755e 7 of this software and associated documentation files (the "Software"), to deal
eduardoG26 2:603b47d3755e 8 in the Software without restriction, including without limitation the rights
eduardoG26 2:603b47d3755e 9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
eduardoG26 2:603b47d3755e 10 copies of the Software, and to permit persons to whom the Software is
eduardoG26 2:603b47d3755e 11 furnished to do so, subject to the following conditions:
eduardoG26 2:603b47d3755e 12
eduardoG26 2:603b47d3755e 13 The above copyright notice and this permission notice shall be included in
eduardoG26 2:603b47d3755e 14 all copies or substantial portions of the Software.
eduardoG26 2:603b47d3755e 15
eduardoG26 2:603b47d3755e 16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
eduardoG26 2:603b47d3755e 17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
eduardoG26 2:603b47d3755e 18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
eduardoG26 2:603b47d3755e 19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
eduardoG26 2:603b47d3755e 20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
eduardoG26 2:603b47d3755e 21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
eduardoG26 2:603b47d3755e 22 THE SOFTWARE.
eduardoG26 2:603b47d3755e 23 */
eduardoG26 2:603b47d3755e 24
eduardoG26 1:158a3886aced 25 #ifndef ENCODER_H_
eduardoG26 1:158a3886aced 26 #define ENCODER_H_
eduardoG26 0:fc87dcec05fd 27
eduardoG26 0:fc87dcec05fd 28 #include "mbed.h"
eduardoG26 0:fc87dcec05fd 29
eduardoG26 0:fc87dcec05fd 30 void EncoderStart ();
eduardoG26 5:70534b19d8bf 31 void EncoderStop ();
eduardoG26 5:70534b19d8bf 32 uint16_t EncoderGetPulses(void);
eduardoG26 5:70534b19d8bf 33 bool EncoderGetPB ();
eduardoG26 0:fc87dcec05fd 34
eduardoG26 1:158a3886aced 35 #endif // ENCODER_H_
eduardoG26 0:fc87dcec05fd 36
eduardoG26 0:fc87dcec05fd 37 // End of file