Problem with analogread always returning 0 on STM32L082KZ

I have some issues with the analog read function of my STM32L082KZ. I have made a custom variants, peripherals file etc. to integrate the board into the PlatformIO environment. In the past (1/2 years ago) it worked perfectly fine but now when i try to use the analogread function it always returns 0. I know for certain it worked with the PA6 pin, but PA 4 and 5 are new pins i want to connect and i know they have slightly different functionality.

I have written a small code to test the functionality:

pinMode(PA4, INPUT);  
pinMode(PA5, INPUT);
pinMode(PA6, INPUT);

Serial.print("Digital: ");
  Serial.print(", ");
  Serial.print(", ");
  adcvalue = analogRead(PA4);
  Serial.print("Analog: ");
  Serial.print(", ");
  Serial.print(", ");

This code shows that when using digitalRead the pin does register a voltage but analogread still returns 0.

My variants.cpp file is built as follows:

// Digital PinName array
const PinName digitalPin[] = {
	PC_14, 		// D0
	PC_15,  	// D1
	PA_8,		// D2
	PA_0,		// D3	STM32: ADC_IN0
	PA_15,		// D4 	Arduino: SS(D4)			STM32: NSS
	PA_11,		// D5
	PA_12,		// D6
	PA_13,		// D7
	PA_14,		// D8
	PB_7,		// D9
	PA_4,		// D10	Arduino: SS1(D10) 		STM32: NSS / ADC_IN4 / DAC_OUT1
	PB_5,		// D11	Arduino: MOSI(D11) 		STM32: MOSI
	PB_4,		// D12	Arduino: M1S0(D12) 		STM32: MISO
	PB_3,		// D13	Arduino: SCK(D13) 		STM32: SCK
	PA_10,		// D14	Arduino: SDA(D14) 		STM32: SDA_1
	PA_9,		// D15	Arduino: SCL(D15) 		STM32: SCL_1
	PA_1,		// D16	STM32: ADC_IN1
	PA_2,		// D17	STM32: ADC_IN2
	PA_3,		// D18	STM32: ADC_IN3
	PB_6,		// D19
	PA_5,		// D20	STM32: ADC_IN5 / DAC_OUT2
	PA_6,		// D21	STM32: ADC_IN6
	PA_7,		// D22	STM32: ADC_IN7
	PB_0,		// D23	STM32: ADC_IN8 / Vref_OUT
	PB_1,		// D24	STM32: ADC_IN9 / Vref_OUT

// Analog (Ax) pin number array
const uint32_t analogInputPin[] = {
  0,  // A0,  PA0
  1,  // A1,  PA1
  2,  // A2,  PA2
  3,  // A3,  PA3
  4,  // A4,  PA4
  5,  // A5,  PA5
  6,  // A6,  PA6
  7,  // A7,  PA7
  16, // A8,  PB0
  17  // A9,  PB1

Insufficient information. Can you upload the whole project + variant files? Specifically PeripheralPins.c and the full variant.h.