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