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