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