Preston Ernst
/
mirror_actuator_VT
-data logging revision
Lib_Misc/EncoderCounter.h@2:92c25cb669f4, 2021-08-24 (annotated)
- Committer:
- ernstpre
- Date:
- Tue Aug 24 08:51:13 2021 +0000
- Revision:
- 2:92c25cb669f4
- Parent:
- 0:d2e117716219
Publish Commit 24/8/21
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
altb2 | 0:d2e117716219 | 1 | /* |
altb2 | 0:d2e117716219 | 2 | * EncoderCounter.h |
altb2 | 0:d2e117716219 | 3 | * Copyright (c) 2017, ZHAW |
altb2 | 0:d2e117716219 | 4 | * All rights reserved. |
altb2 | 0:d2e117716219 | 5 | */ |
altb2 | 0:d2e117716219 | 6 | |
altb2 | 0:d2e117716219 | 7 | #ifndef ENCODER_COUNTER_H_ |
altb2 | 0:d2e117716219 | 8 | #define ENCODER_COUNTER_H_ |
altb2 | 0:d2e117716219 | 9 | |
altb2 | 0:d2e117716219 | 10 | #include <cstdlib> |
altb2 | 0:d2e117716219 | 11 | #include <mbed.h> |
altb2 | 0:d2e117716219 | 12 | |
altb2 | 0:d2e117716219 | 13 | /** |
altb2 | 0:d2e117716219 | 14 | * This class implements a driver to read the quadrature |
altb2 | 0:d2e117716219 | 15 | * encoder counter of the STM32 microcontroller. |
altb2 | 0:d2e117716219 | 16 | */ |
altb2 | 0:d2e117716219 | 17 | class EncoderCounter { |
altb2 | 0:d2e117716219 | 18 | |
altb2 | 0:d2e117716219 | 19 | public: |
altb2 | 0:d2e117716219 | 20 | |
altb2 | 0:d2e117716219 | 21 | EncoderCounter(PinName a, PinName b); |
altb2 | 0:d2e117716219 | 22 | virtual ~EncoderCounter(); |
altb2 | 0:d2e117716219 | 23 | void reset(); |
altb2 | 0:d2e117716219 | 24 | void reset(short offset); |
altb2 | 0:d2e117716219 | 25 | short read(); |
altb2 | 0:d2e117716219 | 26 | operator short(); |
altb2 | 0:d2e117716219 | 27 | |
altb2 | 0:d2e117716219 | 28 | private: |
altb2 | 0:d2e117716219 | 29 | |
altb2 | 0:d2e117716219 | 30 | TIM_TypeDef* TIM; |
altb2 | 0:d2e117716219 | 31 | }; |
altb2 | 0:d2e117716219 | 32 | |
altb2 | 0:d2e117716219 | 33 | #endif /* ENCODER_COUNTER_H_ */ |
altb2 | 0:d2e117716219 | 34 |