Skip to content

Commit 02ecded

Browse files
boards/nucleo-l452re: add doxygen doc to ADC
1 parent 0011497 commit 02ecded

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

boards/nucleo-l452re/include/periph_conf.h

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,36 @@ static const spi_conf_t spi_config[] = {
120120
#define SPI_NUMOF ARRAY_SIZE(spi_config)
121121
/** @} */
122122

123-
static const adc_conf_t adc_config[] = {
123+
/**
124+
* @brief ADC configuration
125+
*
126+
* Note that we do not configure all ADC channels,
127+
* and not in the STM32L452RE order. Instead, we
128+
* just define 6 ADC channels, for the Nucleo
129+
* Arduino header pins A0-A5 and the internal VBAT channel.
130+
*
131+
* To find appropriate device and channel find in the
132+
* board manual, table showing pin assignments and
133+
* information about ADC - a text similar to ADC[X]_IN[Y],
134+
* where:
135+
* [X] - describes used device - indexed from 0,
136+
* for example ADC1_IN10 is device 0,
137+
* [Y] - describes used channel - indexed from 1,
138+
* for example ADC1_IN10 is channel 10
139+
*
140+
* For Nucleo-L452RE this information is in board manual,
141+
* Table 22, page 51, or STM32L452RE MCU datasheet,
142+
* Table 16, page 63.
143+
*
144+
* VBAT is connected ADC1_IN18 or ADC3_IN18 and a voltage divider
145+
* is used, so that only 1/3 of the actual VBAT is measured. This
146+
* allows for a supply voltage higher than the reference voltage.
147+
*
148+
* For STM32L452RE more information is provided in MCU datasheet,
149+
* in section 3.15.3 - Vbat battery voltage monitoring, page 40.
150+
* @{
151+
*/
152+
static const adc_conf_t adc_config[] = {
124153
{ .pin = GPIO_PIN(PORT_A, 0), .dev = 0, .chan = 5 }, /* A0 ADC1_IN5 */
125154
{ .pin = GPIO_PIN(PORT_A, 1), .dev = 0, .chan = 6 }, /* A1 ADC1_IN6 */
126155
{ .pin = GPIO_PIN(PORT_A, 4), .dev = 0, .chan = 9 }, /* A2 ADC1_IN9 */
@@ -130,10 +159,18 @@ static const adc_conf_t adc_config[] = {
130159
{ .pin = GPIO_UNDEF, .dev = 0, .chan = 18 },
131160
};
132161

162+
/**
163+
* @brief Number of ADC devices
164+
*/
133165
#define ADC_NUMOF ARRAY_SIZE(adc_config)
134166

167+
/**
168+
* @brief VBAT ADC line
169+
*/
135170
#define VBAT_ADC ADC_LINE(6)
136171

172+
/** @} */
173+
137174
#ifdef __cplusplus
138175
}
139176
#endif

0 commit comments

Comments
 (0)