var_freq/main.c
static void MX_ADC1_Init(void)
{

  /* USER CODE BEGIN ADC1_Init 0 */

  /* USER CODE END ADC1_Init 0 */

  ADC_ChannelConfTypeDef sConfig = {0};

  /* USER CODE BEGIN ADC1_Init 1 */

  /* USER CODE END ADC1_Init 1 */
  /** Common config 
  */
  hadc1.Instance = ADC1;
  hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE;
  hadc1.Init.ContinuousConvMode = ENABLE;
  hadc1.Init.DiscontinuousConvMode = DISABLE;
  hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
  hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
  hadc1.Init.NbrOfConversion = 4;
  if (HAL_ADC_Init(&hadc1) != HAL_OK)
  {
    Error_Handler();
  }
  /** Configure Regular Channel 
  */
  sConfig.Channel = ADC_CHANNEL_0;
  sConfig.Rank = ADC_REGULAR_RANK_1;
  sConfig.SamplingTime = ADC_SAMPLETIME_28CYCLES_5;
  if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
  {
    Error_Handler();
  }
  /** Configure Regular Channel 
  */
  sConfig.Channel = ADC_CHANNEL_1;	
  sConfig.Rank = ADC_REGULAR_RANK_2;
  if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
  {
    Error_Handler();
  }
  /** Configure Regular Channel 
  */
  sConfig.Channel = ADC_CHANNEL_2;
  sConfig.Rank = ADC_REGULAR_RANK_3;
  if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
  {
    Error_Handler();
  }
  /** Configure Regular Channel 
  */
  sConfig.Channel = ADC_CHANNEL_3;
  sConfig.Rank = ADC_REGULAR_RANK_4;
  if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN ADC1_Init 2 */

  /* USER CODE END ADC1_Init 2 */

}
/**
  * @brief ADC1 Initialization Function
  * @param None
  * @retval None
  */
@brief ADC1 Initialization Function
@param None
@retval None
@brief ADC1 Initialization Function @param None @retval None
static void MX_ADC1_Init(void)
{
  ADC_ChannelConfTypeDef sConfig = {0};
  hadc1.Instance = ADC1;
  hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE;
  hadc1.Init.ContinuousConvMode = ENABLE;
  hadc1.Init.DiscontinuousConvMode = DISABLE;
  hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
  hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
  hadc1.Init.NbrOfConversion = 4;
  if (HAL_ADC_Init(&hadc1) != HAL_OK)
  {
    Error_Handler();
  }
  sConfig.Channel = ADC_CHANNEL_0;
  sConfig.Rank = ADC_REGULAR_RANK_1;
  sConfig.SamplingTime = ADC_SAMPLETIME_28CYCLES_5;
  if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
  {
    Error_Handler();
  }
  sConfig.Channel = ADC_CHANNEL_1;	
  sConfig.Rank = ADC_REGULAR_RANK_2;
  if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
  {
    Error_Handler();
  }
  sConfig.Channel = ADC_CHANNEL_2;
  sConfig.Rank = ADC_REGULAR_RANK_3;
  if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
  {
    Error_Handler();
  }
  sConfig.Channel = ADC_CHANNEL_3;
  sConfig.Rank = ADC_REGULAR_RANK_4;
  if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
  {
    Error_Handler();
  }
}
static void MX_ADC1_Init ( void ) { ADC_ChannelConfTypeDef sConfig = { 0 } ; hadc1 . Instance = ADC1 ; hadc1 . Init . ScanConvMode = ADC_SCAN_ENABLE ; hadc1 . Init . ContinuousConvMode = ENABLE ; hadc1 . Init . DiscontinuousConvMode = DISABLE ; hadc1 . Init . ExternalTrigConv = ADC_SOFTWARE_START ; hadc1 . Init . DataAlign = ADC_DATAALIGN_RIGHT ; hadc1 . Init . NbrOfConversion = 4 ; if ( HAL_ADC_Init ( & hadc1 ) != HAL_OK ) { Error_Handler ( ) ; } sConfig . Channel = ADC_CHANNEL_0 ; sConfig . Rank = ADC_REGULAR_RANK_1 ; sConfig . SamplingTime = ADC_SAMPLETIME_28CYCLES_5 ; if ( HAL_ADC_ConfigChannel ( & hadc1 , & sConfig ) != HAL_OK ) { Error_Handler ( ) ; } sConfig . Channel = ADC_CHANNEL_1 ; sConfig . Rank = ADC_REGULAR_RANK_2 ; if ( HAL_ADC_ConfigChannel ( & hadc1 , & sConfig ) != HAL_OK ) { Error_Handler ( ) ; } sConfig . Channel = ADC_CHANNEL_2 ; sConfig . Rank = ADC_REGULAR_RANK_3 ; if ( HAL_ADC_ConfigChannel ( & hadc1 , & sConfig ) != HAL_OK ) { Error_Handler ( ) ; } sConfig . Channel = ADC_CHANNEL_3 ; sConfig . Rank = ADC_REGULAR_RANK_4 ; if ( HAL_ADC_ConfigChannel ( & hadc1 , & sConfig ) != HAL_OK ) { Error_Handler ( ) ; } }
@brief ADC1 Initialization Function
 @param None
 @retval None
@brief ADC1 Initialization Function @param None @retval None
/* USER CODE BEGIN ADC1_Init 0 */ /* USER CODE END ADC1_Init 0 */ /* USER CODE BEGIN ADC1_Init 1 */ /* USER CODE END ADC1_Init 1 */ /** Common config 
  */ /** Configure Regular Channel 
  */ /** Configure Regular Channel 
  */ /** Configure Regular Channel 
  */ /** Configure Regular Channel 
  */ /* USER CODE BEGIN ADC1_Init 2 */ /* USER CODE END ADC1_Init 2 */