1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards: add VBAT for stm32 based boards with ADC

This commit is contained in:
Fabian Hüßler 2021-10-07 21:19:04 +02:00
parent 33c2944076
commit 9163d78910
28 changed files with 84 additions and 26 deletions

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */

View File

@ -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)
/** @} */