Firstly, add the header files. Configure the clocks if needed.
This header is for STM32F1 change it to your own.
Configure the ADC.
Set hadc.Init.ContinuousConvMode to ENABLE and hadc.Init.EOCSelection to DISABLE for continuous sampling.
Or equivalently on STM32CubeMX.
Simple continuous sampling blinking. hadc is the structure of ADC.
Starts ADC with HAL_ADC_Start.
Then polls all the conversions with HAL_ADC_PollForConversion.
The data retrieved with HAL_ADC_GetValue.
digital value =((Analog input voltage)/(reference voltage high- reference voltage low)) * (2n - 1)
where n = number of bits of ADC digital output