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