AnalogIn low power

I’m working with the STM32L072CZ, but this would apply to the STM32L0 range.

When I add an AnalogIn, either by global declaration or in a function via new(), my sleep current increases by about 270 uA.

My first stab was to enable the auto low power feature in analogin_device.c target file:

obj->handle.Init.LowPowerAutoPowerOff  = ENABLE;

This got me a fair ways by about 240uA.

A further 30 uA I tracked down to both the ADC (CR_ADEN) and ADC voltage regulator (CR_ADVREGEN) being on.

It seems odd that there is no mbed standard way to to reduce (deep)sleep power when using AnalogIn, or am I missing something?