It is based on https://developer.mbed.org/users/gregeric/code/Nucleo_Hello_Encoder/
rotary_encoder_abz_phase/rotary_encoder_abz_phase.hpp
- Committer:
- inst
- Date:
- 2016-04-09
- Revision:
- 5:fae9a340d212
- Parent:
- 3:65021ea3fae5
File content as of revision 5:fae9a340d212:
#ifndef INCLUDED_MBED_STL_ROTARY_ENCODER_ABZ_PHASE_H #define INCLUDED_MBED_STL_ROTARY_ENCODER_ABZ_PHASE_H #include "rotary_encoder_base.hpp" #include "mbed.h" /* * TIM1_CH1: AF1 @ PA_8 * TIM1_CH2: AF1 @ PA_9 * * TIM2_CH1: AF1 @ PA_0 * TIM2_CH2: AF1 @ PA_1 * * TIM3_CH1: AF2 @ PB_4 * TIM3_CH2: AF2 @ PB_5 * * TIM4_CH1: AF2 @ PB_6, PD_12 * TIM4_CH2: AF2 @ PB_7, PD_13 * * TIM5_CH1: AF2 @ PA_0* *TIM5 used by mbed system ticker so unavailable * TIM5_CH2: AF2 @ PA_1* * */ namespace mbed_stl { class rotary_encoder_abz_phase : public rotary_encoder_base { public: rotary_encoder_abz_phase(TIM_TypeDef* timer_type, PinName z_pin, size_t resolution); virtual ~rotary_encoder_abz_phase() {} virtual int32_t get_counts() const; virtual void reset(); private: void intr_z_phase_first(); void intr_z_phase(); InterruptIn z_phase_intr_; uint32_t counts_in_prev_intr_; }; } /* namespace mbed_stl */ #endif