It is based on https://developer.mbed.org/users/gregeric/code/Nucleo_Hello_Encoder/

Revision:
3:65021ea3fae5
Parent:
2:4580c3869b7b
--- a/rotary_encoder_abz_phase/rotary_encoder_abz_phase.cpp	Fri Feb 26 16:08:52 2016 +0000
+++ b/rotary_encoder_abz_phase/rotary_encoder_abz_phase.cpp	Thu Mar 31 04:42:31 2016 +0000
@@ -12,7 +12,7 @@
 }
 
 int32_t rotary_encoder_abz_phase::get_counts() const {
-    int32_t counts = timer_handler_->Instance->CNT;
+    int32_t counts = timer_handler_.Instance->CNT;
     
     if (counts > (max_counts_ >> 1)) {
         return counts - max_counts_;
@@ -21,22 +21,22 @@
 }
 
 void rotary_encoder_abz_phase::intr_z_phase_first() {
-    counts_in_prev_intr_ = timer_handler_->Instance->CNT;
+    counts_in_prev_intr_ = timer_handler_.Instance->CNT;
     z_phase_intr_.fall(this, &rotary_encoder_abz_phase::intr_z_phase);
 }
 
 void rotary_encoder_abz_phase::intr_z_phase() {
-    uint32_t counts = timer_handler_->Instance->CNT;
+    uint32_t counts = timer_handler_.Instance->CNT;
     // Z相の割り込みが入る時は、前回とのカウントの差は分解能で割り切れるはず
     int64_t error = (counts - counts_in_prev_intr_) % resolution_;
-    timer_handler_->Instance->CNT -= error;
+    timer_handler_.Instance->CNT -= error;
     
     counts_in_prev_intr_ = counts;
 }
 
 void rotary_encoder_abz_phase::reset() {
     counts_in_prev_intr_ = 0;
-    timer_handler_->Instance->CNT = 0;
+    timer_handler_.Instance->CNT = 0;
 }
 
 } /* namespace mbed_stl */