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