ggg
EncoderCounter.h@0:df3d4b033d11, 2019-02-27 (annotated)
- Committer:
- cittecla
- Date:
- Wed Feb 27 15:14:27 2019 +0000
- Revision:
- 0:df3d4b033d11
P1 finished
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cittecla | 0:df3d4b033d11 | 1 | /* |
cittecla | 0:df3d4b033d11 | 2 | * EncoderCounter.h |
cittecla | 0:df3d4b033d11 | 3 | * Copyright (c) 2019, ZHAW |
cittecla | 0:df3d4b033d11 | 4 | * All rights reserved. |
cittecla | 0:df3d4b033d11 | 5 | */ |
cittecla | 0:df3d4b033d11 | 6 | |
cittecla | 0:df3d4b033d11 | 7 | #ifndef ENCODER_COUNTER_H_ |
cittecla | 0:df3d4b033d11 | 8 | #define ENCODER_COUNTER_H_ |
cittecla | 0:df3d4b033d11 | 9 | |
cittecla | 0:df3d4b033d11 | 10 | #include <cstdlib> |
cittecla | 0:df3d4b033d11 | 11 | #include <mbed.h> |
cittecla | 0:df3d4b033d11 | 12 | |
cittecla | 0:df3d4b033d11 | 13 | /** |
cittecla | 0:df3d4b033d11 | 14 | * This class implements a driver to read the quadrature |
cittecla | 0:df3d4b033d11 | 15 | * encoder counter of the STM32 microcontroller. |
cittecla | 0:df3d4b033d11 | 16 | */ |
cittecla | 0:df3d4b033d11 | 17 | class EncoderCounter { |
cittecla | 0:df3d4b033d11 | 18 | |
cittecla | 0:df3d4b033d11 | 19 | public: |
cittecla | 0:df3d4b033d11 | 20 | |
cittecla | 0:df3d4b033d11 | 21 | EncoderCounter(PinName a, PinName b); |
cittecla | 0:df3d4b033d11 | 22 | virtual ~EncoderCounter(); |
cittecla | 0:df3d4b033d11 | 23 | void reset(); |
cittecla | 0:df3d4b033d11 | 24 | void reset(short offset); |
cittecla | 0:df3d4b033d11 | 25 | short read(); |
cittecla | 0:df3d4b033d11 | 26 | operator short(); |
cittecla | 0:df3d4b033d11 | 27 | |
cittecla | 0:df3d4b033d11 | 28 | private: |
cittecla | 0:df3d4b033d11 | 29 | |
cittecla | 0:df3d4b033d11 | 30 | TIM_TypeDef* TIM; |
cittecla | 0:df3d4b033d11 | 31 | }; |
cittecla | 0:df3d4b033d11 | 32 | |
cittecla | 0:df3d4b033d11 | 33 | #endif /* ENCODER_COUNTER_H_ */ |