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