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: LSM9DS1 RangeFinder FastPWM
Dependents: PM2_Example_PES_board PM2_Example_PES_board PM2_Example_PES_board PM2_Example_PES_board ... more
EncoderCounter.h@0:86129f1b4a93, 2021-03-30 (annotated)
- Committer:
- pmic
- Date:
- Tue Mar 30 12:21:00 2021 +0000
- Revision:
- 0:86129f1b4a93
- Child:
- 4:9c003c402033
First commit.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| pmic | 0:86129f1b4a93 | 1 | /* |
| pmic | 0:86129f1b4a93 | 2 | * EncoderCounter.h |
| pmic | 0:86129f1b4a93 | 3 | * Copyright (c) 2018, ZHAW |
| pmic | 0:86129f1b4a93 | 4 | * All rights reserved. |
| pmic | 0:86129f1b4a93 | 5 | */ |
| pmic | 0:86129f1b4a93 | 6 | |
| pmic | 0:86129f1b4a93 | 7 | #ifndef ENCODER_COUNTER_H_ |
| pmic | 0:86129f1b4a93 | 8 | #define ENCODER_COUNTER_H_ |
| pmic | 0:86129f1b4a93 | 9 | |
| pmic | 0:86129f1b4a93 | 10 | #include <cstdlib> |
| pmic | 0:86129f1b4a93 | 11 | #include <stdint.h> |
| pmic | 0:86129f1b4a93 | 12 | #include <mbed.h> |
| pmic | 0:86129f1b4a93 | 13 | |
| pmic | 0:86129f1b4a93 | 14 | /** |
| pmic | 0:86129f1b4a93 | 15 | * This class implements a driver to read the quadrature |
| pmic | 0:86129f1b4a93 | 16 | * encoder counter of the STM32 microcontroller. |
| pmic | 0:86129f1b4a93 | 17 | */ |
| pmic | 0:86129f1b4a93 | 18 | class EncoderCounter { |
| pmic | 0:86129f1b4a93 | 19 | |
| pmic | 0:86129f1b4a93 | 20 | public: |
| pmic | 0:86129f1b4a93 | 21 | |
| pmic | 0:86129f1b4a93 | 22 | EncoderCounter(PinName a, PinName b); |
| pmic | 0:86129f1b4a93 | 23 | virtual ~EncoderCounter(); |
| pmic | 0:86129f1b4a93 | 24 | void reset(); |
| pmic | 0:86129f1b4a93 | 25 | void reset(int16_t offset); |
| pmic | 0:86129f1b4a93 | 26 | int16_t read(); |
| pmic | 0:86129f1b4a93 | 27 | operator int16_t(); |
| pmic | 0:86129f1b4a93 | 28 | |
| pmic | 0:86129f1b4a93 | 29 | private: |
| pmic | 0:86129f1b4a93 | 30 | |
| pmic | 0:86129f1b4a93 | 31 | TIM_TypeDef* TIM; |
| pmic | 0:86129f1b4a93 | 32 | }; |
| pmic | 0:86129f1b4a93 | 33 | |
| pmic | 0:86129f1b4a93 | 34 | #endif /* ENCODER_COUNTER_H_ */ |
| pmic | 0:86129f1b4a93 | 35 | |
| pmic | 0:86129f1b4a93 | 36 | |
| pmic | 0:86129f1b4a93 | 37 |
