From b5f7b6b8ed23eccc15415776b6d2fa05e10b9c7d Mon Sep 17 00:00:00 2001 From: Fredrik Thulin Date: Thu, 10 Sep 2015 10:47:08 +0200 Subject: Implement UART outputing of results --- src/fmc-test/src/stm32f4xx_hal_msp.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/fmc-test/src/stm32f4xx_hal_msp.c') diff --git a/src/fmc-test/src/stm32f4xx_hal_msp.c b/src/fmc-test/src/stm32f4xx_hal_msp.c index f932c45..ee2cb7e 100644 --- a/src/fmc-test/src/stm32f4xx_hal_msp.c +++ b/src/fmc-test/src/stm32f4xx_hal_msp.c @@ -103,5 +103,41 @@ void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef* hsram) { } +void HAL_UART_MspInit(UART_HandleTypeDef* huart) +{ + GPIO_InitTypeDef GPIO_InitStruct; + + if (huart->Instance == USART2) { + /* Peripheral clock enable */ + __USART2_CLK_ENABLE(); + __GPIOA_CLK_ENABLE(); + + /**USART2 GPIO Configuration + PA2 ------> USART2_TX + PA3 ------> USART2_RX + */ + GPIO_InitStruct.Pin = GPIO_PIN_2 | GPIO_PIN_3; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_PULLUP; + GPIO_InitStruct.Speed = GPIO_SPEED_LOW; + GPIO_InitStruct.Alternate = GPIO_AF7_USART2; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + } + +} + +void HAL_UART_MspDeInit(UART_HandleTypeDef* huart) +{ + if (huart->Instance == USART2) { + /* Peripheral clock disable */ + __USART2_CLK_DISABLE(); + + /**USART2 GPIO Configuration + PA2 ------> USART2_TX + PA3 ------> USART2_RX + */ + HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2 | GPIO_PIN_3); + } +} /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ -- cgit v1.2.3