32bits encoder counter using 16bits TIM and a 32bits software counter

Dependents:   Asserv_mot Asserv_mot

Fork of Encoder_Nucleo_32_bits by Pierre David

Files at this revision

API Documentation at this revision

Comitter:
Brand101
Date:
Wed Apr 19 17:40:00 2017 +0000
Parent:
6:11dea4c204ba
Commit message:
M1

Changed in this revision

EncoderMspInitF3.cpp Show annotated file Show diff for this revision Revisions of this file
EncoderMspInitF4.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 11dea4c204ba -r c57c8fe63263 EncoderMspInitF3.cpp
--- a/EncoderMspInitF3.cpp	Fri Oct 14 13:38:48 2016 +0000
+++ b/EncoderMspInitF3.cpp	Wed Apr 19 17:40:00 2017 +0000
@@ -55,7 +55,7 @@
     }
 #endif
 #if defined TARGET_STM32F334R8
-    else if (htim->Instance == TIM3) { //PB4 PB5 = Nucleo D5 D4
+    else if (htim->Instance == TIM3) { //PB7 PB5 = Nucleo D5 D4
         __TIM3_CLK_ENABLE();
         __GPIOB_CLK_ENABLE();
         GPIO_InitStruct.Pin = GPIO_PIN_4 | GPIO_PIN_5;
diff -r 11dea4c204ba -r c57c8fe63263 EncoderMspInitF4.cpp
--- a/EncoderMspInitF4.cpp	Fri Oct 14 13:38:48 2016 +0000
+++ b/EncoderMspInitF4.cpp	Wed Apr 19 17:40:00 2017 +0000
@@ -52,15 +52,15 @@
         GPIO_InitStruct.Alternate = GPIO_AF1_TIM2;
         HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
     }
-    else if (htim->Instance == TIM3) { //PB4 PB5 = Nucleo D5 D4
+    else if (htim->Instance == TIM3) { //PA6 PA7 = Nucleo D5 D4 ////////////
         __TIM3_CLK_ENABLE();
-        __GPIOB_CLK_ENABLE();
-        GPIO_InitStruct.Pin = GPIO_PIN_4 | GPIO_PIN_5;
+        __GPIOA_CLK_ENABLE();
+        GPIO_InitStruct.Pin = GPIO_PIN_6 | GPIO_PIN_7;
         GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
         GPIO_InitStruct.Pull = GPIO_PULLDOWN;
         GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
         GPIO_InitStruct.Alternate = GPIO_AF2_TIM3;
-        HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+        HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
     }
     else if (htim->Instance == TIM4) { // PB6 PB7 = Nucleo D10 MORPHO_PB7
         __TIM4_CLK_ENABLE();