Basic library to interface a 2 channel quadrature encoder with mBed
Diff: QuadratureEncoder.h
- Revision:
- 2:fcb3790af96b
- Parent:
- 1:42d1e211e624
diff -r 42d1e211e624 -r fcb3790af96b QuadratureEncoder.h --- a/QuadratureEncoder.h Thu Jul 20 10:40:39 2017 +0000 +++ b/QuadratureEncoder.h Mon Jul 24 14:07:04 2017 +0000 @@ -1,13 +1,30 @@ +/** +* @file QuadratureEncodere.h +* @brief this library allows the MCU to intepret the signal coming from a quadrature encoder. +* @author Lupo Manes +* @date 24/07/2017 +*/ #ifndef _QUADRATUREENCODER_H_ #define _QUADRATUREENCODER_H_ #include "mbed.h" - +/** QuadrtureEncoder class. +* Used to interface with quadrature encoder. +*/ class QuadratureEncoder { public: + /** Create QuadratureEncode instance + * @param pinA Pin to which is connected channel A of the encoder + * @param pinB Pin to which is connected channel Bof the encoder + */ QuadratureEncoder(PinName pinA, PinName pinB); + + /** Return the total number of pulses sent by the encoder. + */ int getTicks(); + /** Set the total number of ticks back to 0. + */ void reset(); private: