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