text: #include "bsp_adc.h"
  #include "main.h"
  
  
  
  uint16_t adcx_get_chx_value(ADC_HandleTypeDef *ADCx, uint32_t ch)
  {
      static ADC_ChannelConfTypeDef sConfig = {0};
      sConfig.Channel = ch;
      sConfig.Rank = 1;
      sConfig.SamplingTime = ADC_SAMPLETIME_480CYCLES;//ADC_SAMPLETIME_3CYCLES;
  
      if (HAL_ADC_ConfigChannel(ADCx, &sConfig) != HAL_OK)
      {
          Error_Handler();
      }
  
      HAL_ADC_Start(ADCx);
  
      HAL_ADC_PollForConversion(ADCx, 10);
      return (uint16_t)HAL_ADC_GetValue(ADCx);
  
  }
  