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