summaryrefslogtreecommitdiff
path: root/stm32cubemx/Src/stm32f1xx_hal_msp.c
diff options
context:
space:
mode:
Diffstat (limited to 'stm32cubemx/Src/stm32f1xx_hal_msp.c')
-rw-r--r--stm32cubemx/Src/stm32f1xx_hal_msp.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/stm32cubemx/Src/stm32f1xx_hal_msp.c b/stm32cubemx/Src/stm32f1xx_hal_msp.c
index eefddb9..b90d153 100644
--- a/stm32cubemx/Src/stm32f1xx_hal_msp.c
+++ b/stm32cubemx/Src/stm32f1xx_hal_msp.c
@@ -125,6 +125,11 @@ void HAL_TIM_IC_MspInit(TIM_HandleTypeDef* htim_ic)
__HAL_LINKDMA(htim_ic,hdma[TIM_DMA_ID_CC1],hdma_tim1_ch1);
+ /* Peripheral interrupt init */
+ HAL_NVIC_SetPriority(TIM1_TRG_COM_IRQn, 1, 0);
+ HAL_NVIC_EnableIRQ(TIM1_TRG_COM_IRQn);
+ HAL_NVIC_SetPriority(TIM1_CC_IRQn, 1, 0);
+ HAL_NVIC_EnableIRQ(TIM1_CC_IRQn);
/* USER CODE BEGIN TIM1_MspInit 1 */
/* USER CODE END TIM1_MspInit 1 */
@@ -154,6 +159,8 @@ void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef* htim_ic)
/* Peripheral interrupt DeInit*/
HAL_NVIC_DisableIRQ(TIM1_TRG_COM_IRQn);
+ HAL_NVIC_DisableIRQ(TIM1_CC_IRQn);
+
}
/* USER CODE BEGIN TIM1_MspDeInit 1 */
@@ -161,6 +168,63 @@ void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef* htim_ic)
}
+void HAL_UART_MspInit(UART_HandleTypeDef* huart)
+{
+
+ GPIO_InitTypeDef GPIO_InitStruct;
+ if(huart->Instance==USART2)
+ {
+ /* USER CODE BEGIN USART2_MspInit 0 */
+
+ /* USER CODE END USART2_MspInit 0 */
+ /* Peripheral clock enable */
+ __HAL_RCC_USART2_CLK_ENABLE();
+
+ /**USART2 GPIO Configuration
+ PA2 ------> USART2_TX
+ PA3 ------> USART2_RX
+ */
+ GPIO_InitStruct.Pin = GPIO_PIN_2;
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ GPIO_InitStruct.Pin = GPIO_PIN_3;
+ GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ /* USER CODE BEGIN USART2_MspInit 1 */
+
+ /* USER CODE END USART2_MspInit 1 */
+ }
+
+}
+
+void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
+{
+
+ if(huart->Instance==USART2)
+ {
+ /* USER CODE BEGIN USART2_MspDeInit 0 */
+
+ /* USER CODE END USART2_MspDeInit 0 */
+ /* Peripheral clock disable */
+ __HAL_RCC_USART2_CLK_DISABLE();
+
+ /**USART2 GPIO Configuration
+ PA2 ------> USART2_TX
+ PA3 ------> USART2_RX
+ */
+ HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3);
+
+ }
+ /* USER CODE BEGIN USART2_MspDeInit 1 */
+
+ /* USER CODE END USART2_MspDeInit 1 */
+
+}
+
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */