From 9163d78910984aa6ba4bc27e18af9b6a835424c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20H=C3=BC=C3=9Fler?= Date: Thu, 7 Oct 2021 21:19:04 +0200 Subject: [PATCH] boards: add VBAT for stm32 based boards with ADC --- boards/common/weact-f4x1cx/include/periph_conf.h | 2 ++ boards/lora-e5-dev/include/periph_conf.h | 2 ++ boards/msbiot/include/periph_conf.h | 4 +++- boards/nucleo-f031k6/include/periph_conf.h | 4 +++- boards/nucleo-f042k6/include/periph_conf.h | 4 +++- boards/nucleo-f072rb/include/periph_conf.h | 4 +++- boards/nucleo-f091rc/include/periph_conf.h | 4 +++- boards/nucleo-f207zg/include/periph_conf.h | 4 +++- boards/nucleo-f302r8/include/periph_conf.h | 4 +++- boards/nucleo-f303k8/include/periph_conf.h | 4 +++- boards/nucleo-f303re/include/periph_conf.h | 4 +++- boards/nucleo-f303ze/include/periph_conf.h | 6 ++++-- boards/nucleo-f334r8/include/periph_conf.h | 4 +++- boards/nucleo-f401re/include/periph_conf.h | 4 +++- boards/nucleo-f410rb/include/periph_conf.h | 4 +++- boards/nucleo-f411re/include/periph_conf.h | 4 +++- boards/nucleo-f412zg/include/periph_conf.h | 4 +++- boards/nucleo-f413zh/include/periph_conf.h | 4 +++- boards/nucleo-f429zi/include/periph_conf.h | 4 +++- boards/nucleo-f446re/include/periph_conf.h | 4 +++- boards/nucleo-f767zi/include/periph_conf.h | 4 +++- boards/nucleo-g070rb/include/periph_conf.h | 4 +++- boards/nucleo-g071rb/include/periph_conf.h | 4 +++- boards/nucleo-l476rg/include/periph_conf.h | 3 +++ boards/stm32f0discovery/include/periph_conf.h | 4 +++- boards/stm32f469i-disco/include/periph_conf.h | 5 ++++- boards/stm32f4discovery/include/periph_conf.h | 4 +++- boards/ublox-c030-u201/include/periph_conf.h | 4 +++- 28 files changed, 84 insertions(+), 26 deletions(-) diff --git a/boards/common/weact-f4x1cx/include/periph_conf.h b/boards/common/weact-f4x1cx/include/periph_conf.h index 37537b72e0..7f10229e36 100644 --- a/boards/common/weact-f4x1cx/include/periph_conf.h +++ b/boards/common/weact-f4x1cx/include/periph_conf.h @@ -179,8 +179,10 @@ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_A, 1), 0, 1}, {GPIO_PIN(PORT_A, 4), 0, 4}, {GPIO_PIN(PORT_B, 0), 0, 8}, + {GPIO_UNDEF, 0, 18} /* VBAT */ }; +#define VBAT_ADC ADC_LINE(4) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/lora-e5-dev/include/periph_conf.h b/boards/lora-e5-dev/include/periph_conf.h index 8c7e6c94c8..4df678de62 100644 --- a/boards/lora-e5-dev/include/periph_conf.h +++ b/boards/lora-e5-dev/include/periph_conf.h @@ -160,8 +160,10 @@ static const i2c_conf_t i2c_config[] = { static const adc_conf_t adc_config[] = { { GPIO_PIN(PORT_B, 3), 2 }, { GPIO_PIN(PORT_B, 4), 3 }, + { GPIO_UNDEF, 14 }, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(2) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/msbiot/include/periph_conf.h b/boards/msbiot/include/periph_conf.h index 353d05ea72..5f3f016323 100644 --- a/boards/msbiot/include/periph_conf.h +++ b/boards/msbiot/include/periph_conf.h @@ -105,9 +105,11 @@ static const pwm_conf_t pwm_config[] = { */ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_B, 0), 0, 8}, - {GPIO_PIN(PORT_B, 1), 0, 9} + {GPIO_PIN(PORT_B, 1), 0, 9}, + {GPIO_UNDEF, 0, 18}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(2) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f031k6/include/periph_conf.h b/boards/nucleo-f031k6/include/periph_conf.h index 725157ffca..2ee35b7ce2 100644 --- a/boards/nucleo-f031k6/include/periph_conf.h +++ b/boards/nucleo-f031k6/include/periph_conf.h @@ -122,9 +122,11 @@ static const adc_conf_t adc_config[] = { { GPIO_PIN(PORT_A, 1), 1 }, { GPIO_PIN(PORT_A, 3), 3 }, { GPIO_PIN(PORT_A, 4), 4 }, - { GPIO_PIN(PORT_A, 7), 7 } + { GPIO_PIN(PORT_A, 7), 7 }, + { GPIO_UNDEF, 18 }, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(5) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f042k6/include/periph_conf.h b/boards/nucleo-f042k6/include/periph_conf.h index d63db22037..79853d068e 100644 --- a/boards/nucleo-f042k6/include/periph_conf.h +++ b/boards/nucleo-f042k6/include/periph_conf.h @@ -132,9 +132,11 @@ static const adc_conf_t adc_config[] = { { GPIO_PIN(PORT_A, 1), 1 }, { GPIO_PIN(PORT_A, 3), 3 }, { GPIO_PIN(PORT_A, 4), 4 }, - { GPIO_PIN(PORT_A, 7), 7 } + { GPIO_PIN(PORT_A, 7), 7 }, + { GPIO_UNDEF, 18 }, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(5) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f072rb/include/periph_conf.h b/boards/nucleo-f072rb/include/periph_conf.h index d4493d4f81..bd07bfb7cc 100644 --- a/boards/nucleo-f072rb/include/periph_conf.h +++ b/boards/nucleo-f072rb/include/periph_conf.h @@ -187,9 +187,11 @@ static const adc_conf_t adc_config[] = { { GPIO_PIN(PORT_A, 4), 4 }, { GPIO_PIN(PORT_B, 0), 8 }, { GPIO_PIN(PORT_C, 1), 11 }, - { GPIO_PIN(PORT_C, 0), 10 } + { GPIO_PIN(PORT_C, 0), 10 }, + { GPIO_UNDEF, 18 }, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f091rc/include/periph_conf.h b/boards/nucleo-f091rc/include/periph_conf.h index a922c54c18..c39216248a 100644 --- a/boards/nucleo-f091rc/include/periph_conf.h +++ b/boards/nucleo-f091rc/include/periph_conf.h @@ -196,9 +196,11 @@ static const adc_conf_t adc_config[] = { { GPIO_PIN(PORT_A, 4), 4 }, { GPIO_PIN(PORT_B, 0), 8 }, { GPIO_PIN(PORT_C, 1), 11 }, - { GPIO_PIN(PORT_C, 0), 10 } + { GPIO_PIN(PORT_C, 0), 10 }, + { GPIO_UNDEF, 18 }, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f207zg/include/periph_conf.h b/boards/nucleo-f207zg/include/periph_conf.h index 3ce29f9a07..764e5c7b5a 100644 --- a/boards/nucleo-f207zg/include/periph_conf.h +++ b/boards/nucleo-f207zg/include/periph_conf.h @@ -236,9 +236,11 @@ static const spi_conf_t spi_config[] = { */ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_A, 3), 0, 3}, - {GPIO_PIN(PORT_C, 0), 1, 0} + {GPIO_PIN(PORT_C, 0), 1, 0}, + {GPIO_UNDEF, 0, 18}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(2) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f302r8/include/periph_conf.h b/boards/nucleo-f302r8/include/periph_conf.h index bf674de8f5..f9c0592220 100644 --- a/boards/nucleo-f302r8/include/periph_conf.h +++ b/boards/nucleo-f302r8/include/periph_conf.h @@ -47,7 +47,7 @@ extern "C" { * Note that we do not configure all ADC channels, * and not in the STM32F302 order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -58,8 +58,10 @@ static const adc_conf_t adc_config[] = { { .pin = GPIO_PIN(PORT_B, 0), .dev = 0, .chan = 11 }, /* ADC_IN11, slow */ { .pin = GPIO_PIN(PORT_C, 1), .dev = 0, .chan = 7 }, /* ADC_IN7, slow */ { .pin = GPIO_PIN(PORT_C, 0), .dev = 0, .chan = 6 }, /* ADC_IN6, slow */ + { .pin = GPIO_UNDEF, .dev = 0, .chan = 17 }, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f303k8/include/periph_conf.h b/boards/nucleo-f303k8/include/periph_conf.h index dc8eca27cd..70be4a9553 100644 --- a/boards/nucleo-f303k8/include/periph_conf.h +++ b/boards/nucleo-f303k8/include/periph_conf.h @@ -33,7 +33,7 @@ extern "C" { * Note that we do not configure all ADC channels, * and not in the STM32F303 order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A3 and A6 + * Arduino header pins A0-A3 and A6 and the internal VBAT channel. * * @{ */ @@ -43,8 +43,10 @@ static const adc_conf_t adc_config[] = { { .pin = GPIO_PIN(PORT_A, 3), .dev = 0, .chan = 4 }, /* ADC1_IN4, fast */ { .pin = GPIO_PIN(PORT_A, 4), .dev = 1, .chan = 1 }, /* ADC2_IN1, fast */ { .pin = GPIO_PIN(PORT_A, 7), .dev = 1, .chan = 4 }, /* ADC2_IN4, fast */ + { .pin = GPIO_UNDEF, .dev = 0, .chan = 17 }, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(5) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f303re/include/periph_conf.h b/boards/nucleo-f303re/include/periph_conf.h index 3a8c5e956d..d04f6b8542 100644 --- a/boards/nucleo-f303re/include/periph_conf.h +++ b/boards/nucleo-f303re/include/periph_conf.h @@ -45,7 +45,7 @@ extern "C" { * Note that we do not configure all ADC channels, * and not in the STM32F334 order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -56,8 +56,10 @@ static const adc_conf_t adc_config[] = { { .pin = GPIO_PIN(PORT_B, 0), .dev = 2, .chan = 12 }, /* ADC3_IN12, slow */ { .pin = GPIO_PIN(PORT_C, 1), .dev = 1, .chan = 7 }, /* ADC12_IN7, slow */ { .pin = GPIO_PIN(PORT_C, 0), .dev = 1, .chan = 6 }, /* ADC12_IN6, slow */ + { .pin = GPIO_UNDEF, .dev = 0, .chan = 17 }, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f303ze/include/periph_conf.h b/boards/nucleo-f303ze/include/periph_conf.h index 1109a35248..fd5e0fc7aa 100644 --- a/boards/nucleo-f303ze/include/periph_conf.h +++ b/boards/nucleo-f303ze/include/periph_conf.h @@ -43,7 +43,7 @@ extern "C" { * Note that we do not configure all ADC channels, * and not in the STM32F303 order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -53,9 +53,11 @@ static const adc_conf_t adc_config[] = { { .pin = GPIO_PIN(PORT_C, 3), .dev = 1, .chan = 9 }, /* ADC12_IN9, slow */ { .pin = GPIO_PIN(PORT_D, 11), .dev = 2, .chan = 8 }, /* ADC34_IN8, slow */ { .pin = GPIO_PIN(PORT_D, 12), .dev = 3, .chan = 9 }, /* ADC34_IN9, slow */ - { .pin = GPIO_PIN(PORT_D, 13), .dev = 3, .chan = 10 }, /* ADC34_IN10, slo */ + { .pin = GPIO_PIN(PORT_D, 13), .dev = 3, .chan = 10 }, /* ADC34_IN10, slow */ + { .pin = GPIO_UNDEF, .dev = 0, .chan = 17 }, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f334r8/include/periph_conf.h b/boards/nucleo-f334r8/include/periph_conf.h index 3beccc5c40..a259fb4475 100644 --- a/boards/nucleo-f334r8/include/periph_conf.h +++ b/boards/nucleo-f334r8/include/periph_conf.h @@ -44,7 +44,7 @@ extern "C" { * Note that we do not configure all ADC channels, * and not in the STM32F334 order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -55,8 +55,10 @@ static const adc_conf_t adc_config[] = { { .pin = GPIO_PIN(PORT_B, 0), .dev = 0, .chan = 11 }, /* ADC1_IN11, slow */ { .pin = GPIO_PIN(PORT_C, 1), .dev = 1, .chan = 7 }, /* ADC12_IN7, slow */ { .pin = GPIO_PIN(PORT_C, 0), .dev = 1, .chan = 6 }, /* ADC12_IN6, slow */ + { .pin = GPIO_UNDEF, .dev = 0, .chan = 17 }, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f401re/include/periph_conf.h b/boards/nucleo-f401re/include/periph_conf.h index 75144e4985..f7988faea2 100644 --- a/boards/nucleo-f401re/include/periph_conf.h +++ b/boards/nucleo-f401re/include/periph_conf.h @@ -243,7 +243,7 @@ static const spi_conf_t spi_config[] = { * Note that we do not configure all ADC channels, * and not in the STM32F401 order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -254,8 +254,10 @@ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_B, 0), 0, 8}, {GPIO_PIN(PORT_C, 1), 0, 11}, {GPIO_PIN(PORT_C, 0), 0, 10}, + {GPIO_UNDEF, 0, 18}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f410rb/include/periph_conf.h b/boards/nucleo-f410rb/include/periph_conf.h index 4f532576ea..c1e33d8591 100644 --- a/boards/nucleo-f410rb/include/periph_conf.h +++ b/boards/nucleo-f410rb/include/periph_conf.h @@ -146,7 +146,7 @@ static const spi_conf_t spi_config[] = { * Note that we do not configure all ADC channels, * and not in the STM32F410 order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -157,8 +157,10 @@ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_B, 0), 0, 8}, {GPIO_PIN(PORT_C, 1), 0, 11}, {GPIO_PIN(PORT_C, 0), 0, 10}, + {GPIO_UNDEF, 0, 18}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f411re/include/periph_conf.h b/boards/nucleo-f411re/include/periph_conf.h index c980f06345..d19cee5ee3 100644 --- a/boards/nucleo-f411re/include/periph_conf.h +++ b/boards/nucleo-f411re/include/periph_conf.h @@ -175,7 +175,7 @@ static const spi_conf_t spi_config[] = { * Note that we do not configure all ADC channels, * and not in the STM32F411 order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -186,8 +186,10 @@ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_B, 0), 0, 8}, {GPIO_PIN(PORT_C, 1), 0, 11}, {GPIO_PIN(PORT_C, 0), 0, 10}, + {GPIO_UNDEF, 0, 18}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f412zg/include/periph_conf.h b/boards/nucleo-f412zg/include/periph_conf.h index 295944522e..24ef5ccc1d 100644 --- a/boards/nucleo-f412zg/include/periph_conf.h +++ b/boards/nucleo-f412zg/include/periph_conf.h @@ -177,7 +177,7 @@ static const spi_conf_t spi_config[] = { * Note that we do not configure all ADC channels, * and not in the STM32F412zg order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -188,8 +188,10 @@ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_C, 1), 0, 11}, {GPIO_PIN(PORT_C, 4), 0, 14}, {GPIO_PIN(PORT_C, 5), 0, 15}, + {GPIO_UNDEF, 0, 18}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f413zh/include/periph_conf.h b/boards/nucleo-f413zh/include/periph_conf.h index f9ac88d1f2..0c890ddd7f 100644 --- a/boards/nucleo-f413zh/include/periph_conf.h +++ b/boards/nucleo-f413zh/include/periph_conf.h @@ -178,7 +178,7 @@ static const spi_conf_t spi_config[] = { * Note that we do not configure all ADC channels, * and not in the STM32F413zh order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -189,8 +189,10 @@ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_C, 1), 0, 11}, {GPIO_PIN(PORT_C, 4), 0, 14}, {GPIO_PIN(PORT_C, 5), 0, 15}, + {GPIO_UNDEF, 0, 18}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f429zi/include/periph_conf.h b/boards/nucleo-f429zi/include/periph_conf.h index a63cec064e..d3c5c94e3c 100644 --- a/boards/nucleo-f429zi/include/periph_conf.h +++ b/boards/nucleo-f429zi/include/periph_conf.h @@ -175,7 +175,7 @@ static const spi_conf_t spi_config[] = { * Note that we do not configure all ADC channels, * and not in the STM32F429zi order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -186,8 +186,10 @@ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_F, 3), 2, 9}, {GPIO_PIN(PORT_F, 5), 2, 15}, {GPIO_PIN(PORT_F, 10), 2, 8}, + {GPIO_UNDEF, 0, 18}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f446re/include/periph_conf.h b/boards/nucleo-f446re/include/periph_conf.h index f6a3270e93..0c5dc8dffd 100644 --- a/boards/nucleo-f446re/include/periph_conf.h +++ b/boards/nucleo-f446re/include/periph_conf.h @@ -253,7 +253,7 @@ static const spi_conf_t spi_config[] = { * Note that we do not configure all ADC channels, * and not in the STM32F446 order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -264,8 +264,10 @@ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_B, 0), 0, 8}, {GPIO_PIN(PORT_C, 1), 0, 11}, {GPIO_PIN(PORT_C, 0), 0, 10}, + {GPIO_UNDEF, 0, 18}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-f767zi/include/periph_conf.h b/boards/nucleo-f767zi/include/periph_conf.h index 413af7e7f9..86b2b762ad 100644 --- a/boards/nucleo-f767zi/include/periph_conf.h +++ b/boards/nucleo-f767zi/include/periph_conf.h @@ -193,7 +193,7 @@ static const eth_conf_t eth_config = { * Note that we do not configure all ADC channels, * and not in the STM32F767ZI order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -204,8 +204,10 @@ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_F, 3), 2, 9}, {GPIO_PIN(PORT_F, 5), 2, 15}, {GPIO_PIN(PORT_F, 10), 2, 8}, + {GPIO_UNDEF, 0, 18}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-g070rb/include/periph_conf.h b/boards/nucleo-g070rb/include/periph_conf.h index 43d2283200..ef8ef584ad 100644 --- a/boards/nucleo-g070rb/include/periph_conf.h +++ b/boards/nucleo-g070rb/include/periph_conf.h @@ -92,7 +92,7 @@ static const uart_conf_t uart_config[] = { * Note that we do not configure all ADC channels, * and not in the STM32G070 order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -103,8 +103,10 @@ static const adc_conf_t adc_config[] = { { .pin = GPIO_PIN(PORT_B, 1), .dev = 0, .chan = 9 }, { .pin = GPIO_PIN(PORT_B, 11), .dev = 0, .chan = 15 }, { .pin = GPIO_PIN(PORT_B, 12), .dev = 0, .chan = 16 }, + { .pin = GPIO_UNDEF, .dev = 0, .chan = 14}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-g071rb/include/periph_conf.h b/boards/nucleo-g071rb/include/periph_conf.h index 0f72106c73..39c21772db 100644 --- a/boards/nucleo-g071rb/include/periph_conf.h +++ b/boards/nucleo-g071rb/include/periph_conf.h @@ -90,7 +90,7 @@ static const uart_conf_t uart_config[] = { * Note that we do not configure all ADC channels, * and not in the STM32G071 order. Instead, we * just define 6 ADC channels, for the Nucleo - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -101,8 +101,10 @@ static const adc_conf_t adc_config[] = { { .pin = GPIO_PIN(PORT_B, 1), .dev = 0, .chan = 9 }, { .pin = GPIO_PIN(PORT_B, 11), .dev = 0, .chan = 15 }, { .pin = GPIO_PIN(PORT_B, 12), .dev = 0, .chan = 16 }, + { .pin = GPIO_UNDEF, .dev = 0, .chan = 14}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/nucleo-l476rg/include/periph_conf.h b/boards/nucleo-l476rg/include/periph_conf.h index 72ffa469ca..73ab16133d 100644 --- a/boards/nucleo-l476rg/include/periph_conf.h +++ b/boards/nucleo-l476rg/include/periph_conf.h @@ -210,6 +210,7 @@ static const spi_conf_t spi_config[] = { * @name ADC configuration * * configure only ADC channels for the Arduino header pins A0-A5 + * and the internal VBAT channel * * @{ */ @@ -220,8 +221,10 @@ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_B, 0), 1, 15}, /*< ADC12_IN15 */ {GPIO_PIN(PORT_C, 1), 2, 2}, /*< ADC123_IN_2 */ {GPIO_PIN(PORT_C, 0), 2, 1}, /*< ADC123_IN_1 */ + {GPIO_UNDEF, 0, 18}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/stm32f0discovery/include/periph_conf.h b/boards/stm32f0discovery/include/periph_conf.h index 80ed7af6fb..0d8edc9614 100644 --- a/boards/stm32f0discovery/include/periph_conf.h +++ b/boards/stm32f0discovery/include/periph_conf.h @@ -96,9 +96,11 @@ static const adc_conf_t adc_config[] = { { GPIO_PIN(PORT_C, 2), 12 }, { GPIO_PIN(PORT_C, 3), 13 }, { GPIO_PIN(PORT_C, 4), 14 }, - { GPIO_PIN(PORT_C, 5), 15 } + { GPIO_PIN(PORT_C, 5), 15 }, + { GPIO_UNDEF, 18 }, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/stm32f469i-disco/include/periph_conf.h b/boards/stm32f469i-disco/include/periph_conf.h index dceeff9271..cda8c0e319 100644 --- a/boards/stm32f469i-disco/include/periph_conf.h +++ b/boards/stm32f469i-disco/include/periph_conf.h @@ -227,7 +227,7 @@ static const pwm_conf_t pwm_config[] = { * @name ADC configuration * * Not all ADCs are configured, by now, only the 6 ones available - * on the Arduino(R) connector A0-A5 + * on the Arduino(R) connector A0-A5 and internal VBAT ADC channel. * @{ */ static const adc_conf_t adc_config[] = { @@ -237,7 +237,10 @@ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_C, 4), 2, 14}, {GPIO_PIN(PORT_C, 5), 2, 15}, {GPIO_PIN(PORT_A, 4), 2, 4}, + {GPIO_UNDEF, 0, 18}, /* VBAT */ }; + +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/stm32f4discovery/include/periph_conf.h b/boards/stm32f4discovery/include/periph_conf.h index db0295dd8c..d2cd062f9c 100644 --- a/boards/stm32f4discovery/include/periph_conf.h +++ b/boards/stm32f4discovery/include/periph_conf.h @@ -131,9 +131,11 @@ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_A, 1), 0, 1}, {GPIO_PIN(PORT_A, 4), 0, 4}, {GPIO_PIN(PORT_C, 1), 1, 11}, - {GPIO_PIN(PORT_C, 2), 1, 12} + {GPIO_PIN(PORT_C, 2), 1, 12}, + {GPIO_UNDEF, 0, 18}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(4) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ diff --git a/boards/ublox-c030-u201/include/periph_conf.h b/boards/ublox-c030-u201/include/periph_conf.h index 4a6c166510..be59574078 100644 --- a/boards/ublox-c030-u201/include/periph_conf.h +++ b/boards/ublox-c030-u201/include/periph_conf.h @@ -222,7 +222,7 @@ static const i2c_conf_t i2c_config[] = { * Note that we do not configure all ADC channels, * and not in the STM32F437 order. Instead, we * just define 6 ADC channels, for the - * Arduino header pins A0-A5 + * Arduino header pins A0-A5 and the internal VBAT channel. * * @{ */ @@ -233,8 +233,10 @@ static const adc_conf_t adc_config[] = { {GPIO_PIN(PORT_A, 4), 0, 14}, {GPIO_PIN(PORT_B, 7), 0, 7}, {GPIO_PIN(PORT_B, 6), 0, 6}, + {GPIO_UNDEF, 0, 18}, /* VBAT */ }; +#define VBAT_ADC ADC_LINE(6) /**< VBAT ADC line */ #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */