14 #include "stm32l4xx_hal.h" 31 UsartHandle.Init.OverSampling = UART_OVERSAMPLING_16;
40 GPIO_InitTypeDef GPIO_InitStruct;
42 __HAL_RCC_GPIOD_CLK_ENABLE();
43 __HAL_RCC_USART2_CLK_ENABLE();
45 GPIO_InitStruct.Pin = GPIO_PIN_5;
46 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
47 GPIO_InitStruct.Pull = GPIO_PULLUP;
48 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
49 GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
50 HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
53 GPIO_InitStruct.Pin = GPIO_PIN_6;
54 GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
56 HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
void usart_init(void)
USART Configuration to talk to ST-LINK.
USART Initialization to stream printf() output back to the ST-LINK.
UART_HandleTypeDef UsartHandle