It is based on https://developer.mbed.org/users/gregeric/code/Nucleo_Hello_Encoder/
rotary_encoder_abz_phase/rotary_encoder_abz_phase.hpp@0:caf1d0bc4b90, 2016-02-06 (annotated)
- Committer:
- inst
- Date:
- Sat Feb 06 14:24:56 2016 +0000
- Revision:
- 0:caf1d0bc4b90
- Child:
- 1:0b315dd1bbbf
many classes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
inst | 0:caf1d0bc4b90 | 1 | #ifndef INCLUDED_ROTARY_ENCODER_A_PHASE_H |
inst | 0:caf1d0bc4b90 | 2 | #define INCLUDED_ROTARY_ENCODER_A_PHASE_H |
inst | 0:caf1d0bc4b90 | 3 | |
inst | 0:caf1d0bc4b90 | 4 | #include "rotary_encoder_base.hpp" |
inst | 0:caf1d0bc4b90 | 5 | #include "mbed.h" |
inst | 0:caf1d0bc4b90 | 6 | |
inst | 0:caf1d0bc4b90 | 7 | /* |
inst | 0:caf1d0bc4b90 | 8 | * TIM1_CH1: AF1 @ PA_8 |
inst | 0:caf1d0bc4b90 | 9 | * TIM1_CH2: AF1 @ PA_9 |
inst | 0:caf1d0bc4b90 | 10 | * |
inst | 0:caf1d0bc4b90 | 11 | * TIM2_CH1: AF1 @ PA_0 |
inst | 0:caf1d0bc4b90 | 12 | * TIM2_CH2: AF1 @ PA_1 |
inst | 0:caf1d0bc4b90 | 13 | * |
inst | 0:caf1d0bc4b90 | 14 | * TIM3_CH1: AF2 @ PB_4 |
inst | 0:caf1d0bc4b90 | 15 | * TIM3_CH2: AF2 @ PB_5 |
inst | 0:caf1d0bc4b90 | 16 | * |
inst | 0:caf1d0bc4b90 | 17 | * TIM4_CH1: AF2 @ PB_6, PD_12 |
inst | 0:caf1d0bc4b90 | 18 | * TIM4_CH2: AF2 @ PB_7, PD_13 |
inst | 0:caf1d0bc4b90 | 19 | * |
inst | 0:caf1d0bc4b90 | 20 | * TIM5_CH1: AF2 @ PA_0* *TIM5 used by mbed system ticker so unavailable |
inst | 0:caf1d0bc4b90 | 21 | * TIM5_CH2: AF2 @ PA_1* |
inst | 0:caf1d0bc4b90 | 22 | * |
inst | 0:caf1d0bc4b90 | 23 | */ |
inst | 0:caf1d0bc4b90 | 24 | |
inst | 0:caf1d0bc4b90 | 25 | class rotary_encoder_abz_phase : public rotary_encoder_base { |
inst | 0:caf1d0bc4b90 | 26 | public: |
inst | 0:caf1d0bc4b90 | 27 | rotary_encoder_abz_phase(TIM_TypeDef* timer_type, PinName z_pin, size_t resolution); |
inst | 0:caf1d0bc4b90 | 28 | virtual ~rotary_encoder_abz_phase() {} |
inst | 0:caf1d0bc4b90 | 29 | |
inst | 0:caf1d0bc4b90 | 30 | virtual int32_t get_counts() const; |
inst | 0:caf1d0bc4b90 | 31 | |
inst | 0:caf1d0bc4b90 | 32 | virtual void reset(); |
inst | 0:caf1d0bc4b90 | 33 | |
inst | 0:caf1d0bc4b90 | 34 | private: |
inst | 0:caf1d0bc4b90 | 35 | void intr_z_phase_first(); |
inst | 0:caf1d0bc4b90 | 36 | void intr_z_phase(); |
inst | 0:caf1d0bc4b90 | 37 | |
inst | 0:caf1d0bc4b90 | 38 | InterruptIn z_phase_intr_; |
inst | 0:caf1d0bc4b90 | 39 | uint32_t counts_in_prev_intr_; |
inst | 0:caf1d0bc4b90 | 40 | }; |
inst | 0:caf1d0bc4b90 | 41 | |
inst | 0:caf1d0bc4b90 | 42 | #endif |