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