Miscellaneous Library, read Encoder etc.
EncoderCounter.h@1:c680da75a614, 2019-03-06 (annotated)
- Committer:
- altb
- Date:
- Wed Mar 06 14:19:10 2019 +0000
- Revision:
- 1:c680da75a614
- Parent:
- 0:3312872854c4
dropped Signal
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
altb | 0:3312872854c4 | 1 | /* |
altb | 0:3312872854c4 | 2 | * EncoderCounter.h |
altb | 0:3312872854c4 | 3 | * Copyright (c) 2017, ZHAW |
altb | 0:3312872854c4 | 4 | * All rights reserved. |
altb | 0:3312872854c4 | 5 | */ |
altb | 0:3312872854c4 | 6 | |
altb | 0:3312872854c4 | 7 | #ifndef ENCODER_COUNTER_H_ |
altb | 0:3312872854c4 | 8 | #define ENCODER_COUNTER_H_ |
altb | 0:3312872854c4 | 9 | |
altb | 0:3312872854c4 | 10 | #include <cstdlib> |
altb | 0:3312872854c4 | 11 | #include <mbed.h> |
altb | 0:3312872854c4 | 12 | |
altb | 0:3312872854c4 | 13 | /** |
altb | 0:3312872854c4 | 14 | * This class implements a driver to read the quadrature |
altb | 0:3312872854c4 | 15 | * encoder counter of the STM32 microcontroller. |
altb | 0:3312872854c4 | 16 | */ |
altb | 0:3312872854c4 | 17 | class EncoderCounter { |
altb | 0:3312872854c4 | 18 | |
altb | 0:3312872854c4 | 19 | public: |
altb | 0:3312872854c4 | 20 | |
altb | 0:3312872854c4 | 21 | EncoderCounter(PinName a, PinName b); |
altb | 0:3312872854c4 | 22 | virtual ~EncoderCounter(); |
altb | 0:3312872854c4 | 23 | void reset(); |
altb | 0:3312872854c4 | 24 | void reset(short offset); |
altb | 0:3312872854c4 | 25 | short read(); |
altb | 0:3312872854c4 | 26 | operator short(); |
altb | 0:3312872854c4 | 27 | |
altb | 0:3312872854c4 | 28 | private: |
altb | 0:3312872854c4 | 29 | |
altb | 0:3312872854c4 | 30 | TIM_TypeDef* TIM; |
altb | 0:3312872854c4 | 31 | }; |
altb | 0:3312872854c4 | 32 | |
altb | 0:3312872854c4 | 33 | #endif /* ENCODER_COUNTER_H_ */ |