![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
PES2_mbed_os_6
EncoderCounter.h@3:a292bdaf03f6, 2021-03-16 (annotated)
- Committer:
- boro
- Date:
- Tue Mar 16 17:28:04 2021 +0100
- Revision:
- 3:a292bdaf03f6
- Parent:
- 0:5d4d21d56334
controller updated
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
boro | 0:5d4d21d56334 | 1 | /* |
boro | 0:5d4d21d56334 | 2 | * EncoderCounter.h |
boro | 0:5d4d21d56334 | 3 | * Copyright (c) 2018, ZHAW |
boro | 0:5d4d21d56334 | 4 | * All rights reserved. |
boro | 0:5d4d21d56334 | 5 | */ |
boro | 0:5d4d21d56334 | 6 | |
boro | 0:5d4d21d56334 | 7 | #ifndef ENCODER_COUNTER_H_ |
boro | 0:5d4d21d56334 | 8 | #define ENCODER_COUNTER_H_ |
boro | 0:5d4d21d56334 | 9 | |
boro | 0:5d4d21d56334 | 10 | #include <cstdlib> |
boro | 0:5d4d21d56334 | 11 | #include <stdint.h> |
boro | 0:5d4d21d56334 | 12 | #include <mbed.h> |
boro | 0:5d4d21d56334 | 13 | |
boro | 0:5d4d21d56334 | 14 | /** |
boro | 0:5d4d21d56334 | 15 | * This class implements a driver to read the quadrature |
boro | 0:5d4d21d56334 | 16 | * encoder counter of the STM32 microcontroller. |
boro | 0:5d4d21d56334 | 17 | */ |
boro | 0:5d4d21d56334 | 18 | class EncoderCounter { |
boro | 0:5d4d21d56334 | 19 | |
boro | 0:5d4d21d56334 | 20 | public: |
boro | 0:5d4d21d56334 | 21 | |
boro | 0:5d4d21d56334 | 22 | EncoderCounter(PinName a, PinName b); |
boro | 0:5d4d21d56334 | 23 | virtual ~EncoderCounter(); |
boro | 0:5d4d21d56334 | 24 | void reset(); |
boro | 0:5d4d21d56334 | 25 | void reset(int16_t offset); |
boro | 0:5d4d21d56334 | 26 | int16_t read(); |
boro | 0:5d4d21d56334 | 27 | operator int16_t(); |
boro | 0:5d4d21d56334 | 28 | |
boro | 0:5d4d21d56334 | 29 | private: |
boro | 0:5d4d21d56334 | 30 | |
boro | 0:5d4d21d56334 | 31 | TIM_TypeDef* TIM; |
boro | 0:5d4d21d56334 | 32 | }; |
boro | 0:5d4d21d56334 | 33 | |
boro | 0:5d4d21d56334 | 34 | #endif /* ENCODER_COUNTER_H_ */ |
boro | 0:5d4d21d56334 | 35 | |
boro | 0:5d4d21d56334 | 36 | |
boro | 0:5d4d21d56334 | 37 |