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