Grundfunktionen für Micromouse
Dependencies: AutomationElements mbed
MotorDriver/EncoderCounter.h@1:4808f55970e8, 2018-04-22 (annotated)
- Committer:
- wengefa1
- Date:
- Sun Apr 22 09:55:40 2018 +0000
- Revision:
- 1:4808f55970e8
- Parent:
- 0:e38b500d6e74
Grundfunktionen funktionieren
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wengefa1 | 0:e38b500d6e74 | 1 | /* |
wengefa1 | 0:e38b500d6e74 | 2 | * EncoderCounter.h |
wengefa1 | 0:e38b500d6e74 | 3 | * Copyright (c) 2018, ZHAW |
wengefa1 | 0:e38b500d6e74 | 4 | * All rights reserved. |
wengefa1 | 0:e38b500d6e74 | 5 | */ |
wengefa1 | 0:e38b500d6e74 | 6 | |
wengefa1 | 0:e38b500d6e74 | 7 | #ifndef ENCODER_COUNTER_H_ |
wengefa1 | 0:e38b500d6e74 | 8 | #define ENCODER_COUNTER_H_ |
wengefa1 | 0:e38b500d6e74 | 9 | |
wengefa1 | 0:e38b500d6e74 | 10 | #include <cstdlib> |
wengefa1 | 0:e38b500d6e74 | 11 | #include <mbed.h> |
wengefa1 | 0:e38b500d6e74 | 12 | |
wengefa1 | 0:e38b500d6e74 | 13 | /** |
wengefa1 | 0:e38b500d6e74 | 14 | * This class implements a driver to read the quadrature |
wengefa1 | 0:e38b500d6e74 | 15 | * encoder counter of the STM32 microcontroller. |
wengefa1 | 0:e38b500d6e74 | 16 | */ |
wengefa1 | 0:e38b500d6e74 | 17 | class EncoderCounter { |
wengefa1 | 0:e38b500d6e74 | 18 | |
wengefa1 | 0:e38b500d6e74 | 19 | public: |
wengefa1 | 0:e38b500d6e74 | 20 | |
wengefa1 | 0:e38b500d6e74 | 21 | EncoderCounter(PinName a, PinName b); |
wengefa1 | 0:e38b500d6e74 | 22 | virtual ~EncoderCounter(); |
wengefa1 | 0:e38b500d6e74 | 23 | void reset(); |
wengefa1 | 0:e38b500d6e74 | 24 | void reset(short offset); |
wengefa1 | 0:e38b500d6e74 | 25 | short read(); |
wengefa1 | 0:e38b500d6e74 | 26 | operator short(); |
wengefa1 | 0:e38b500d6e74 | 27 | |
wengefa1 | 0:e38b500d6e74 | 28 | private: |
wengefa1 | 0:e38b500d6e74 | 29 | |
wengefa1 | 0:e38b500d6e74 | 30 | TIM_TypeDef* TIM; |
wengefa1 | 0:e38b500d6e74 | 31 | }; |
wengefa1 | 0:e38b500d6e74 | 32 | |
wengefa1 | 0:e38b500d6e74 | 33 | #endif /* ENCODER_COUNTER_H_ */ |
wengefa1 | 0:e38b500d6e74 | 34 | |
wengefa1 | 0:e38b500d6e74 | 35 |