Welcome @artchace, to the community!
If you haven't already done so, I would recommend taking a look at the SPL examples in STSW-STM8016. The software package has a folder Project\STM8L15x_StdPeriph_Examples where you will find several examples of how to use the ADC.
Hope that helps?
Regards
/Peter
In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.