32bits encoder counter using 16bits TIM and a 32bits software counter
Dependents: Asserv_mot Asserv_mot
Fork of Encoder_Nucleo_32_bits by
Diff: EncoderMspInitF4.cpp
- Revision:
- 7:c57c8fe63263
- Parent:
- 0:ebd170807e11
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();