![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Version12.04.18
Fork of Micromouse_beta by
EncoderCounter.h@1:d9e840c48b1e, 2018-03-31 (annotated)
- Committer:
- ruesipat
- Date:
- Sat Mar 31 16:45:57 2018 +0000
- Revision:
- 1:d9e840c48b1e
- Parent:
- 0:a9fe4ef404bf
j
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ruesipat | 0:a9fe4ef404bf | 1 | /* |
ruesipat | 0:a9fe4ef404bf | 2 | * EncoderCounter.h |
ruesipat | 0:a9fe4ef404bf | 3 | * Copyright (c) 2018, ZHAW |
ruesipat | 0:a9fe4ef404bf | 4 | * All rights reserved. |
ruesipat | 0:a9fe4ef404bf | 5 | */ |
ruesipat | 0:a9fe4ef404bf | 6 | |
ruesipat | 0:a9fe4ef404bf | 7 | #ifndef ENCODER_COUNTER_H_ |
ruesipat | 0:a9fe4ef404bf | 8 | #define ENCODER_COUNTER_H_ |
ruesipat | 0:a9fe4ef404bf | 9 | |
ruesipat | 0:a9fe4ef404bf | 10 | #include <cstdlib> |
ruesipat | 0:a9fe4ef404bf | 11 | #include <mbed.h> |
ruesipat | 0:a9fe4ef404bf | 12 | |
ruesipat | 0:a9fe4ef404bf | 13 | /** |
ruesipat | 0:a9fe4ef404bf | 14 | * This class implements a driver to read the quadrature |
ruesipat | 0:a9fe4ef404bf | 15 | * encoder counter of the STM32 microcontroller. |
ruesipat | 0:a9fe4ef404bf | 16 | */ |
ruesipat | 1:d9e840c48b1e | 17 | class EncoderCounter |
ruesipat | 1:d9e840c48b1e | 18 | { |
ruesipat | 1:d9e840c48b1e | 19 | |
ruesipat | 1:d9e840c48b1e | 20 | public: |
ruesipat | 1:d9e840c48b1e | 21 | |
ruesipat | 1:d9e840c48b1e | 22 | EncoderCounter(PinName a, PinName b); |
ruesipat | 1:d9e840c48b1e | 23 | virtual ~EncoderCounter(); |
ruesipat | 1:d9e840c48b1e | 24 | void reset(); |
ruesipat | 1:d9e840c48b1e | 25 | void reset(short offset); |
ruesipat | 1:d9e840c48b1e | 26 | short read(); |
ruesipat | 1:d9e840c48b1e | 27 | operator short(); |
ruesipat | 1:d9e840c48b1e | 28 | |
ruesipat | 1:d9e840c48b1e | 29 | private: |
ruesipat | 1:d9e840c48b1e | 30 | |
ruesipat | 1:d9e840c48b1e | 31 | TIM_TypeDef* TIM; |
ruesipat | 0:a9fe4ef404bf | 32 | }; |
ruesipat | 0:a9fe4ef404bf | 33 | |
ruesipat | 0:a9fe4ef404bf | 34 | #endif /* ENCODER_COUNTER_H_ */ |