Analog reading 3 pins after each other
I have F303RE.
The pin config are:

The ADC config is:

The Adc init code is generated as well the Analog Gpios. That is not a problem.
I want to read one after each other.
I added a function to select to config, but I dont know what SHould I pass the rank or the channel (or both). Here is the Adc select channel or rank function.
void select_adc(uint32_t rank_or_channel)
{
ADC_ChannelConfTypeDef sConfig;
sConfig.Channel = rank_or_chammel; // ADC_CHANNEL_1;
sConfig.Rank = rank_or_chammel; // ADC_REGULAR_RANK_1;
sConfig.SingleDiff = ADC_SINGLE_ENDED;
sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;
sConfig.OffsetNumber = ADC_OFFSET_NONE;
sConfig.Offset = 0;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
}
And here is how do I call it.
int RORC=1; // PA0=1 PA1=2 PA2=3
while ( 1 )
{
HAL_ADC_Start(&hadc1);
select_adc(RORC );
if(HAL_ADC_PollForConversion(&hadc1, 1000) == HAL_OK)
{
uint32_t av = HAL_ADC_GetValue(&hadc1);
printf("%d adc = %d \r\n",RORC, av);
}
HAL_ADC_Stop(&hadc1);
HAL_Delay(1000);
if(RORC++>3)
PIN_RANK_OR_CHANNEL=1;
}Which way is the correct way read, one after each-other
What values in sConfig have to pinpoint the PA pin ?.
Thank you very much.