Sinking charge from LED before taking measurement
So finally I solved it by switching the GPIO port between analog in for reading and digital out with an internal pull-down for discharging the capacitance.
In order to perform the switch I manipulated the STM32F303RET6's MODER and PUPDR registers directly, which is very fast.
Very pleased with the solution.
// configure DMA and ADC
...
// save existing register values for undoing the change once the capacitance is discharged
_moderA = GPIOA-&gt;MODER;
_pupdrA = GPIOA-&gt;PUPDR;
_moderC = GPIOC-&gt;MODER;
_pupdrC = GPIOC-&gt;PUPDR;
/**
 * Pinout
 *
 * A0   PA4
 * A1   PA5
 * A2   PA6
 * A3   PA7
 * A4   PC4
 * A5   PC5
 * A6   PC0
 * A7   PC1
 * A8   PC2
 * A9   PC3
 */
// switch to digital out and enable internal pull-down resistors on the fly
GPIOA-&gt;MODER &amp;= 0b11111111111111110101010111111111;  // set PA4-PA7 to general output
GPIOC-&gt;MODER &amp;= 0b11111111111111111111010101010101;  // set PC0-PC5 to general output
GPIOA-&gt;PUPDR &amp;= 0b11111111111111111010101011111111;  // set PA4-PA7 to use pull-down
GPIOC-&gt;MODER &amp;= 0b11111111111111111111101010101010;  // set PC0-PC5 to use pull-down

// switch back to analog in
GPIOA-&gt;PUPDR = _pupdrA;
GPIOA-&gt;MODER = _moderA;
GPIOC-&gt;PUPDR = _pupdrC;
GPIOC-&gt;MODER = _moderC;

// take measurement using ADC
...