diff --git a/boards/stm32l476g-disco/include/periph_conf.h b/boards/stm32l476g-disco/include/periph_conf.h index dfb4b514d0..205f848059 100644 --- a/boards/stm32l476g-disco/include/periph_conf.h +++ b/boards/stm32l476g-disco/include/periph_conf.h @@ -80,6 +80,35 @@ static const uart_conf_t uart_config[] = { #define UART_NUMOF ARRAY_SIZE(uart_config) /** @} */ +/** + * @brief ADC configuration + * + * Note that we do not configure all ADC channels, + * and not in the STM32L476VG order. Instead, we + * just define 5 ADC channels, for the next adjacent + * 5 pins, from 10 to 14, in the header P1 and the + * internal VBAT channel. + * + * To find appropriate device and channel find in the + * board manual, table showing pin assignments and + * information about ADC - a text similar to ADC[X]_IN[Y], + * where: + * [X] - describes used device - indexed from 0, + * for example ADC12_IN10 is device 0 or device 1, + * [Y] - describes used channel - indexed from 1, + * for example ADC12_IN10 is channel 10 + * + * For STM32L476VG this information is in MCU datasheet, + * Table 16, page 73. + * + * VBAT is connected ADC1_IN18 or ADC3_IN18 and a voltage divider + * is used, so that only 1/3 of the actual VBAT is measured. This + * allows for a supply voltage higher than the reference voltage. + * + * For STM32L476VG more information is provided in MCU datasheet, + * in section 3.15.3 - Vbat battery voltage monitoring, page 42. + * @{ + */ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_A, 0), 0, 5}, /*< ADC12_IN5 */ {GPIO_PIN(PORT_A, 5), 0, 10}, /*< ADC12_IN10 */ @@ -89,9 +118,16 @@ static const adc_conf_t adc_config[] = { {GPIO_UNDEF, 0, 18}, /* VBAT */ }; -#define VBAT_ADC ADC_LINE(5) /**< VBAT ADC line */ +/** + * @brief VBAT ADC line + */ +#define VBAT_ADC ADC_LINE(5) +/** + * @brief Number of ADC devices + */ #define ADC_NUMOF ARRAY_SIZE(adc_config) +/** @} */ #ifdef __cplusplus }