STM32l1xx Internal ADC Channels

Hi Francisco,

We did it a while ago, it’s quite easy.

https://github.com/unwireddevices/RIOT/blob/master/cpu/stm32l1/periph/adc.c

https://github.com/unwireddevices/RIOT/blob/master/cpu/stm32l1/include/periph_cpu.h

  1. In board.h configure internal ADC channels with GPIO_UNDEF pin

#define ADC_CONFIG { \

{ GPIO_PIN(PORT_A, 1), 1 },\

{ GPIO_PIN(PORT_A, 2), 2 },\

{ GPIO_PIN(PORT_A, 3), 3 },\

{ GPIO_PIN(PORT_A, 4), 4 },\

{ GPIO_PIN(PORT_A, 5), 5 },\

{ GPIO_PIN(PORT_A, 6), 6 }, \

{ GPIO_PIN(PORT_A, 7), 7 }, \

{ GPIO_UNDEF, ADC_VREF_CHANNEL}, \

{ GPIO_UNDEF, ADC_TEMPERATURE_CHANNEL}, \

}

  1. In adc.c do not initialize GPIO if it equals GPIO_UNDEF (lines 87-90)

  2. In adc.c before accessing internal lines, wake up sensor and Vref (lines 171-174), after getting data disable it (lines 206-207)

That’s it.