A program to monitor some parameters for a motor

Dependencies:   mbed-dev BufferSerial

Thanks to David Lowe for https://developer.mbed.org/users/gregeric/code/Nucleo_Hello_Encoder/ which I adapted for the use of TIM2 32bit timer as an encoder reader on the Nucleo L432KC board.

Revision:
1:a611582bffa7
Parent:
0:789510d98ade
Child:
2:958e9094b198
--- a/Encoder/EncoderMspInitL4.cpp	Wed Mar 08 16:59:48 2017 +0000
+++ b/Encoder/EncoderMspInitL4.cpp	Wed Mar 08 21:37:30 2017 +0000
@@ -16,15 +16,6 @@
  * TIM2_CH1: AF1 @ PA0, PA5, PA15
  * TIM2_CH2: AF1 @ PA1, PB3
  *
- * TIM3_CH1: AF2 @ PA6, PB4, PC6, PE3
- * TIM3_CH2: AF2 @ PA7, PB5, PC7, PE4
- *
- * TIM4_CH1: AF2 @ PB6, PD12
- * TIM4_CH2: AF2 @ PB7, PD13
- *
- * TIM5_CH1: AF2 @ PA0, PF6
- * TIM5_CH2: AF2 @ PA1, PF7
- *
  */
 
 #ifdef TARGET_STM32L4
@@ -32,7 +23,7 @@
 {
     GPIO_InitTypeDef GPIO_InitStruct;
 
-    if (htim->Instance == TIM1) {       //PA8 PA9 = Nucleo D7 D8
+    if (htim->Instance == TIM1) {       //PA8 PA9 = Nucleo D9 D1
         __TIM1_CLK_ENABLE();
         __GPIOA_CLK_ENABLE();
         GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9;
@@ -52,35 +43,5 @@
         GPIO_InitStruct.Alternate = GPIO_AF1_TIM2;
         HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
     }
-    else if (htim->Instance == TIM3) {  //PB4 PB5 = Nucleo D5 D4
-        __TIM3_CLK_ENABLE();
-        __GPIOB_CLK_ENABLE();
-        GPIO_InitStruct.Pin = GPIO_PIN_4 | GPIO_PIN_5;
-        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);
-    }
-    else if (htim->Instance == TIM4) { // PB6 PB7 = Nucleo D10 MORPHO_PB7
-        __TIM4_CLK_ENABLE();
-        __GPIOB_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_TIM4;
-        HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
-    }
-    else if (htim->Instance == TIM5) { // here for completeness, mbed sytem timer uses this
-        __TIM5_CLK_ENABLE();
-        __GPIOA_CLK_ENABLE();
-        GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1;
-        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
-        GPIO_InitStruct.Pull = GPIO_PULLDOWN;
-        GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
-        GPIO_InitStruct.Alternate = GPIO_AF2_TIM5;
-        HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
-    }
 }
 #endif
\ No newline at end of file