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

Revision:
4:d07f58c46a79
Parent:
3:65021ea3fae5
Child:
5:fae9a340d212
--- a/rotary_encoder_base/rotary_encoder_base.cpp	Thu Mar 31 04:42:31 2016 +0000
+++ b/rotary_encoder_base/rotary_encoder_base.cpp	Sun Apr 03 06:30:19 2016 +0000
@@ -7,8 +7,13 @@
 rotary_encoder_base::rotary_encoder_base(TIM_TypeDef* timer_type,
                                         uint32_t encoder_mode,
                                         size_t resolution) : rotary_encoder(resolution) {
-    static size_t cnt = 0;
-    //printf("cnt : %d\n", cnt);
+                                            
+                                            
+    
+    // todo:delete debug
+    encoder_mode = TIM_ENCODERMODE_TI12;
+    resolution = 400;
+    
     
     timer_handler_.Instance              = timer_type;
     timer_handler_.Init.Period           = max_counts_;
@@ -31,11 +36,9 @@
     
     ////////////////////////////////////////
     //printf("t:%d, e:%d", &timer_handler_, &encoder);
-/*
     if (HAL_TIM_Encoder_Init(&timer_handler_, &encoder) != HAL_OK) {
         error("couldn't init encoder\n");
     }
-*/
     //printf("%d end\n", cnt++);
     ///////////////////////////////////////////
 }