Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
EncoderCounter.h@1:2b5f79285a3e, 2018-04-19 (annotated)
- Committer:
- Helvis
- Date:
- Thu Apr 19 06:19:43 2018 +0000
- Revision:
- 1:2b5f79285a3e
Micromouse V0.9: Tresholds + Regler noch anpassen
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Helvis | 1:2b5f79285a3e | 1 | /* |
| Helvis | 1:2b5f79285a3e | 2 | * EncoderCounter.h |
| Helvis | 1:2b5f79285a3e | 3 | * Copyright (c) 2018, ZHAW |
| Helvis | 1:2b5f79285a3e | 4 | * All rights reserved. |
| Helvis | 1:2b5f79285a3e | 5 | */ |
| Helvis | 1:2b5f79285a3e | 6 | |
| Helvis | 1:2b5f79285a3e | 7 | #ifndef ENCODER_COUNTER_H_ |
| Helvis | 1:2b5f79285a3e | 8 | #define ENCODER_COUNTER_H_ |
| Helvis | 1:2b5f79285a3e | 9 | |
| Helvis | 1:2b5f79285a3e | 10 | #include <cstdlib> |
| Helvis | 1:2b5f79285a3e | 11 | #include <mbed.h> |
| Helvis | 1:2b5f79285a3e | 12 | |
| Helvis | 1:2b5f79285a3e | 13 | /** |
| Helvis | 1:2b5f79285a3e | 14 | * This class implements a driver to read the quadrature |
| Helvis | 1:2b5f79285a3e | 15 | * encoder counter of the STM32 microcontroller. |
| Helvis | 1:2b5f79285a3e | 16 | */ |
| Helvis | 1:2b5f79285a3e | 17 | class EncoderCounter { |
| Helvis | 1:2b5f79285a3e | 18 | |
| Helvis | 1:2b5f79285a3e | 19 | public: |
| Helvis | 1:2b5f79285a3e | 20 | |
| Helvis | 1:2b5f79285a3e | 21 | EncoderCounter(PinName a, PinName b); |
| Helvis | 1:2b5f79285a3e | 22 | virtual ~EncoderCounter(); |
| Helvis | 1:2b5f79285a3e | 23 | void reset(); |
| Helvis | 1:2b5f79285a3e | 24 | void reset(short offset); |
| Helvis | 1:2b5f79285a3e | 25 | short read(); |
| Helvis | 1:2b5f79285a3e | 26 | operator short(); |
| Helvis | 1:2b5f79285a3e | 27 | |
| Helvis | 1:2b5f79285a3e | 28 | private: |
| Helvis | 1:2b5f79285a3e | 29 | |
| Helvis | 1:2b5f79285a3e | 30 | TIM_TypeDef* TIM; |
| Helvis | 1:2b5f79285a3e | 31 | }; |
| Helvis | 1:2b5f79285a3e | 32 | |
| Helvis | 1:2b5f79285a3e | 33 | #endif /* ENCODER_COUNTER_H_ */ |
