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