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