Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: EncoderMspInitF7.cpp
- Revision:
- 6:978bd0579f1b
- Parent:
- 5:a3349f37ef99
- Child:
- 7:d7c793ec5c04
--- a/EncoderMspInitF7.cpp Thu Jan 17 05:20:49 2019 +0000
+++ b/EncoderMspInitF7.cpp Fri Jan 25 07:58:34 2019 +0000
@@ -40,17 +40,25 @@
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF1_TIM1;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+ HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
}
- else if (htim->Instance == TIM2) { //PA_0 PA_1
+ else if (htim->Instance == TIM2) { //PA_15 PB_3
__TIM2_CLK_ENABLE();
__GPIOA_CLK_ENABLE();
- GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1;
+ __GPIOB_CLK_ENABLE();
+ GPIO_InitStruct.Pin = GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF1_TIM2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ GPIO_InitStruct.Pin = GPIO_PIN_3;
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+ GPIO_InitStruct.Alternate = GPIO_AF1_TIM2;
+ HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
}
else if (htim->Instance == TIM3) { //PB_4 PB_5
__TIM3_CLK_ENABLE();
@@ -70,7 +78,7 @@
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF2_TIM4;
- HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+ HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
}
else if (htim->Instance == TIM8) { // PC_6 PC_7
@@ -103,7 +111,7 @@
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF9_TIM12;
- HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
+ HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
}
}