demo-stm32f303-receiver/Core/Src/main.c
/**
  * @brief USART2 Initialization Function
  * @param None
  * @retval None
  */
@brief USART2 Initialization Function
@param None
@retval None
@brief USART2 Initialization Function @param None @retval None
static void MX_USART2_UART_Init(void)
{
  LL_USART_InitTypeDef USART_InitStruct = {0};
  LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
  LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
  LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
  GPIO_InitStruct.Pin = USART_TX_Pin|USART_RX_Pin;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
  GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
  GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
  GPIO_InitStruct.Alternate = LL_GPIO_AF_7;
  LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  USART_InitStruct.BaudRate = 115200;
  USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
  USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
  USART_InitStruct.Parity = LL_USART_PARITY_NONE;
  USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
  USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
  USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;
  LL_USART_Init(USART2, &USART_InitStruct);
  LL_USART_DisableIT_CTS(USART2);
  LL_USART_DisableOverrunDetect(USART2);
  LL_USART_ConfigAsyncMode(USART2);
  LL_USART_Enable(USART2);
}
static void MX_USART2_UART_Init ( void ) { LL_USART_InitTypeDef USART_InitStruct = { 0 } ; LL_GPIO_InitTypeDef GPIO_InitStruct = { 0 } ; LL_APB1_GRP1_EnableClock ( LL_APB1_GRP1_PERIPH_USART2 ) ; LL_AHB1_GRP1_EnableClock ( LL_AHB1_GRP1_PERIPH_GPIOA ) ; GPIO_InitStruct . Pin = USART_TX_Pin | USART_RX_Pin ; GPIO_InitStruct . Mode = LL_GPIO_MODE_ALTERNATE ; GPIO_InitStruct . Speed = LL_GPIO_SPEED_FREQ_LOW ; GPIO_InitStruct . OutputType = LL_GPIO_OUTPUT_PUSHPULL ; GPIO_InitStruct . Pull = LL_GPIO_PULL_NO ; GPIO_InitStruct . Alternate = LL_GPIO_AF_7 ; LL_GPIO_Init ( GPIOA , & GPIO_InitStruct ) ; USART_InitStruct . BaudRate = 115200 ; USART_InitStruct . DataWidth = LL_USART_DATAWIDTH_8B ; USART_InitStruct . StopBits = LL_USART_STOPBITS_1 ; USART_InitStruct . Parity = LL_USART_PARITY_NONE ; USART_InitStruct . TransferDirection = LL_USART_DIRECTION_TX_RX ; USART_InitStruct . HardwareFlowControl = LL_USART_HWCONTROL_NONE ; USART_InitStruct . OverSampling = LL_USART_OVERSAMPLING_16 ; LL_USART_Init ( USART2 , & USART_InitStruct ) ; LL_USART_DisableIT_CTS ( USART2 ) ; LL_USART_DisableOverrunDetect ( USART2 ) ; LL_USART_ConfigAsyncMode ( USART2 ) ; LL_USART_Enable ( USART2 ) ; }
@brief USART2 Initialization Function
 @param None
 @retval None
@brief USART2 Initialization Function @param None @retval None
/* USER CODE BEGIN USART2_Init 0 */ /* USER CODE END USART2_Init 0 */ /* Peripheral clock enable */ /**USART2 GPIO Configuration  
  PA2   ------> USART2_TX
  PA3   ------> USART2_RX 
  */ /* USER CODE BEGIN USART2_Init 1 */ /* USER CODE END USART2_Init 1 */ /* USER CODE BEGIN USART2_Init 2 */ /* USER CODE END USART2_Init 2 */