From a45a194594932f31a5d355465085032a039c361c Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 12:15:27 +0200 Subject: [PATCH 01/41] boards/nucleo-f070rb: declare adc_config[] directly in periph_conf.h --- boards/nucleo-f070rb/include/periph_conf.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/boards/nucleo-f070rb/include/periph_conf.h b/boards/nucleo-f070rb/include/periph_conf.h index 7f63d55329..6c5bca7fcd 100644 --- a/boards/nucleo-f070rb/include/periph_conf.h +++ b/boards/nucleo-f070rb/include/periph_conf.h @@ -154,16 +154,16 @@ static const pwm_conf_t pwm_config[] = { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_A, 0), 0 },\ - { GPIO_PIN(PORT_A, 1), 1 },\ - { GPIO_PIN(PORT_A, 4), 4 },\ - { GPIO_PIN(PORT_B, 0), 8 },\ - { GPIO_PIN(PORT_C, 1), 11 },\ - { GPIO_PIN(PORT_C, 0), 10 } \ -} +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_A, 0), 0 }, + { GPIO_PIN(PORT_A, 1), 1 }, + { GPIO_PIN(PORT_A, 4), 4 }, + { GPIO_PIN(PORT_B, 0), 8 }, + { GPIO_PIN(PORT_C, 1), 11 }, + { GPIO_PIN(PORT_C, 0), 10 } +}; -#define ADC_NUMOF (6) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 737b8c0ff48cacaca535a6928fb63642b0d00d9c Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 12:19:01 +0200 Subject: [PATCH 02/41] boards/nz32-sc151: declare adc_config[] directly in periph_conf.h --- boards/nz32-sc151/include/periph_conf.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/boards/nz32-sc151/include/periph_conf.h b/boards/nz32-sc151/include/periph_conf.h index 632c7493e6..821fb7357f 100644 --- a/boards/nz32-sc151/include/periph_conf.h +++ b/boards/nz32-sc151/include/periph_conf.h @@ -191,17 +191,17 @@ static const i2c_conf_t i2c_config[] = { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_C, 0), 10 }, \ - { GPIO_PIN(PORT_C, 1), 11 }, \ - { GPIO_PIN(PORT_C, 2), 12 }, \ - /* ADC Temperature channel */ \ - { GPIO_UNDEF, 16 }, \ - /* ADC VREF channel */ \ - { GPIO_UNDEF, 17 }, \ -} +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_C, 0), 10 }, + { GPIO_PIN(PORT_C, 1), 11 }, + { GPIO_PIN(PORT_C, 2), 12 }, + /* ADC Temperature channel */ + { GPIO_UNDEF, 16 }, + /* ADC VREF channel */ + { GPIO_UNDEF, 17 }, +}; -#define ADC_NUMOF (5) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ /** From c6362a54418d4e02335ed86840ae3a859d616a0a Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 12:23:41 +0200 Subject: [PATCH 03/41] boards/common/blxxxpill: declare adc_config[] directly in periph_conf.h --- boards/common/blxxxpill/include/periph_conf.h | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/boards/common/blxxxpill/include/periph_conf.h b/boards/common/blxxxpill/include/periph_conf.h index f83138affa..5ce6e6363e 100644 --- a/boards/common/blxxxpill/include/periph_conf.h +++ b/boards/common/blxxxpill/include/periph_conf.h @@ -72,22 +72,22 @@ extern "C" { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { .dev = 0, .pin = GPIO_PIN(PORT_A, 0), .chan = 0 }, \ - { .dev = 0, .pin = GPIO_PIN(PORT_A, 1), .chan = 1 }, \ - { .dev = 0, .pin = GPIO_PIN(PORT_A, 4), .chan = 4 }, \ - { .dev = 0, .pin = GPIO_PIN(PORT_A, 5), .chan = 5 }, \ - { .dev = 0, .pin = GPIO_PIN(PORT_A, 6), .chan = 6 }, \ - { .dev = 0, .pin = GPIO_PIN(PORT_A, 7), .chan = 7 }, \ - { .dev = 0, .pin = GPIO_PIN(PORT_B, 0), .chan = 8 }, \ - { .dev = 0, .pin = GPIO_PIN(PORT_B, 1), .chan = 9 }, \ - /* ADC Temperature channel */ \ - { .dev = 0, .pin = GPIO_UNDEF, .chan = 16 }, \ - /* ADC VREF channel */ \ - { .dev = 0, .pin = GPIO_UNDEF, .chan = 17 }, \ -} +static const adc_conf_t adc_config[] = { + { .dev = 0, .pin = GPIO_PIN(PORT_A, 0), .chan = 0 }, + { .dev = 0, .pin = GPIO_PIN(PORT_A, 1), .chan = 1 }, + { .dev = 0, .pin = GPIO_PIN(PORT_A, 4), .chan = 4 }, + { .dev = 0, .pin = GPIO_PIN(PORT_A, 5), .chan = 5 }, + { .dev = 0, .pin = GPIO_PIN(PORT_A, 6), .chan = 6 }, + { .dev = 0, .pin = GPIO_PIN(PORT_A, 7), .chan = 7 }, + { .dev = 0, .pin = GPIO_PIN(PORT_B, 0), .chan = 8 }, + { .dev = 0, .pin = GPIO_PIN(PORT_B, 1), .chan = 9 }, + /* ADC Temperature channel */ + { .dev = 0, .pin = GPIO_UNDEF, .chan = 16 }, + /* ADC VREF channel */ + { .dev = 0, .pin = GPIO_UNDEF, .chan = 17 }, +}; -#define ADC_NUMOF 10 +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ /** From 6a71c35d6061500b15bfc9a36fec99c46c4c1690 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:25:42 +0200 Subject: [PATCH 04/41] boards/common/iotlab: declare adc_config[] directly in periph_conf.h --- boards/common/iotlab/include/periph_conf_common.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/boards/common/iotlab/include/periph_conf_common.h b/boards/common/iotlab/include/periph_conf_common.h index 5dbc3094d6..178a6e0853 100644 --- a/boards/common/iotlab/include/periph_conf_common.h +++ b/boards/common/iotlab/include/periph_conf_common.h @@ -60,12 +60,13 @@ extern "C" { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_A,3), 0, 3 }, \ - { GPIO_UNDEF , 0, 16 }, \ - { GPIO_UNDEF , 0, 17 } } +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_A,3), 0, 3 }, + { GPIO_UNDEF , 0, 16 }, + { GPIO_UNDEF , 0, 17 } +}; -#define ADC_NUMOF (3) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ /** From 04d4b025fcf555470d26dec071c1e3a3ce6aabc3 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:28:34 +0200 Subject: [PATCH 05/41] boards/airfy-beacon: declare adc_config[] directly in periph_conf.h --- boards/airfy-beacon/include/periph_conf.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/boards/airfy-beacon/include/periph_conf.h b/boards/airfy-beacon/include/periph_conf.h index f10fc2d679..bd35bc4ed9 100644 --- a/boards/airfy-beacon/include/periph_conf.h +++ b/boards/airfy-beacon/include/periph_conf.h @@ -86,8 +86,9 @@ static const i2c_conf_t i2c_config[] = { * The configuration consists simply of a list of channels that should be used * @{ */ -#define ADC_CONFIG {3, 4, 5, 6} -#define ADC_NUMOF (4) +static const adc_conf_t adc_config[] = {3, 4, 5, 6}; + +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 0c026c84e39f1f3b850fa9ad26be4362c8a80ebb Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:31:55 +0200 Subject: [PATCH 06/41] boards/im880b: declare adc_config[] directly in periph_conf.h --- boards/im880b/include/periph_conf.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/boards/im880b/include/periph_conf.h b/boards/im880b/include/periph_conf.h index bf835d76cd..cab463da5f 100644 --- a/boards/im880b/include/periph_conf.h +++ b/boards/im880b/include/periph_conf.h @@ -161,17 +161,17 @@ static const i2c_conf_t i2c_config[] = { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_A, 0), 0 }, /* P14 */ \ - { GPIO_PIN(PORT_A, 1), 1 }, /* P15 */ \ - { GPIO_PIN(PORT_A, 3), 3 }, /* P17 */ \ - /* ADC Temperature channel */ \ - { GPIO_UNDEF, 16 }, \ - /* ADC VREF channel */ \ - { GPIO_UNDEF, 17 }, \ -} +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_A, 0), 0 }, /* P14 */ + { GPIO_PIN(PORT_A, 1), 1 }, /* P15 */ + { GPIO_PIN(PORT_A, 3), 3 }, /* P17 */ + /* ADC Temperature channel */ + { GPIO_UNDEF, 16 }, + /* ADC VREF channel */ + { GPIO_UNDEF, 17 }, +}; -#define ADC_NUMOF (5) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 58fbd8b443279669c4c86ffc9a81fdb1cba4d00e Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:34:00 +0200 Subject: [PATCH 07/41] boards/msbiot: declare adc_config[] directly in periph_conf.h --- boards/msbiot/include/periph_conf.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/boards/msbiot/include/periph_conf.h b/boards/msbiot/include/periph_conf.h index 04be24b152..0833a6e66a 100644 --- a/boards/msbiot/include/periph_conf.h +++ b/boards/msbiot/include/periph_conf.h @@ -95,12 +95,12 @@ static const pwm_conf_t pwm_config[] = { * PIN, device (ADCx), channel * @{ */ -#define ADC_CONFIG { \ - {GPIO_PIN(PORT_B, 0), 0, 8}, \ - {GPIO_PIN(PORT_B, 1), 0, 9} \ -} +static const adc_conf_t adc_config[] = { + {GPIO_PIN(PORT_B, 0), 0, 8}, + {GPIO_PIN(PORT_B, 1), 0, 9} +}; -#define ADC_NUMOF (2) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ /** From f4d5c6bf67742f4299cfd883da12a4d7e31cb9dd Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:38:47 +0200 Subject: [PATCH 08/41] boards/nucleo-f030r8: declare adc_config[] directly in periph_conf.h --- boards/nucleo-f030r8/include/periph_conf.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/boards/nucleo-f030r8/include/periph_conf.h b/boards/nucleo-f030r8/include/periph_conf.h index 83e65a52c7..4b8fb8119a 100644 --- a/boards/nucleo-f030r8/include/periph_conf.h +++ b/boards/nucleo-f030r8/include/periph_conf.h @@ -177,16 +177,16 @@ static const spi_conf_t spi_config[] = { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_A, 0), 0 }, \ - { GPIO_PIN(PORT_A, 1), 1 }, \ - { GPIO_PIN(PORT_A, 4), 4 }, \ - { GPIO_PIN(PORT_B, 0), 8 }, \ - { GPIO_PIN(PORT_C, 1), 11 },\ - { GPIO_PIN(PORT_C, 0), 10 } \ -} +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_A, 0), 0 }, + { GPIO_PIN(PORT_A, 1), 1 }, + { GPIO_PIN(PORT_A, 4), 4 }, + { GPIO_PIN(PORT_B, 0), 8 }, + { GPIO_PIN(PORT_C, 1), 11 }, + { GPIO_PIN(PORT_C, 0), 10 } +}; -#define ADC_NUMOF (6) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 3c374bb5f3d932408056ed586444c432fde53797 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:41:42 +0200 Subject: [PATCH 09/41] boards/nucleo-f031k6: declare adc_config[] directly in periph_conf.h --- boards/nucleo-f031k6/include/periph_conf.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/boards/nucleo-f031k6/include/periph_conf.h b/boards/nucleo-f031k6/include/periph_conf.h index 75a07bccb4..7019fcadfb 100644 --- a/boards/nucleo-f031k6/include/periph_conf.h +++ b/boards/nucleo-f031k6/include/periph_conf.h @@ -144,15 +144,15 @@ static const spi_conf_t spi_config[] = { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_A, 0), 0 }, \ - { GPIO_PIN(PORT_A, 1), 1 }, \ - { GPIO_PIN(PORT_A, 3), 3 }, \ - { GPIO_PIN(PORT_A, 4), 4 }, \ - { GPIO_PIN(PORT_A, 7), 7 } \ -} +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_A, 0), 0 }, + { GPIO_PIN(PORT_A, 1), 1 }, + { GPIO_PIN(PORT_A, 3), 3 }, + { GPIO_PIN(PORT_A, 4), 4 }, + { GPIO_PIN(PORT_A, 7), 7 } +}; -#define ADC_NUMOF (5) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 84f3ec9035392cbedda9f8facf59632062555c1e Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:43:21 +0200 Subject: [PATCH 10/41] boards/nucleo-f042k6: declare adc_config[] directly in periph_conf.h --- boards/nucleo-f042k6/include/periph_conf.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/boards/nucleo-f042k6/include/periph_conf.h b/boards/nucleo-f042k6/include/periph_conf.h index cbfe1a8710..b82a2b0d9b 100644 --- a/boards/nucleo-f042k6/include/periph_conf.h +++ b/boards/nucleo-f042k6/include/periph_conf.h @@ -154,15 +154,15 @@ static const spi_conf_t spi_config[] = { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_A, 0), 0 }, \ - { GPIO_PIN(PORT_A, 1), 1 }, \ - { GPIO_PIN(PORT_A, 3), 3 }, \ - { GPIO_PIN(PORT_A, 4), 4 }, \ - { GPIO_PIN(PORT_A, 7), 7 } \ -} +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_A, 0), 0 }, + { GPIO_PIN(PORT_A, 1), 1 }, + { GPIO_PIN(PORT_A, 3), 3 }, + { GPIO_PIN(PORT_A, 4), 4 }, + { GPIO_PIN(PORT_A, 7), 7 } +}; -#define ADC_NUMOF (5) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 1e51da6b59f761d540952c33bb636c614101d27f Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:45:00 +0200 Subject: [PATCH 11/41] boards/nucleo-f072rb: declare adc_config[] directly in periph_conf.h --- boards/nucleo-f072rb/include/periph_conf.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/boards/nucleo-f072rb/include/periph_conf.h b/boards/nucleo-f072rb/include/periph_conf.h index e814432ed4..06f58920e4 100644 --- a/boards/nucleo-f072rb/include/periph_conf.h +++ b/boards/nucleo-f072rb/include/periph_conf.h @@ -198,16 +198,16 @@ static const spi_conf_t spi_config[] = { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_A, 0), 0 }, \ - { GPIO_PIN(PORT_A, 1), 1 }, \ - { GPIO_PIN(PORT_A, 4), 4 }, \ - { GPIO_PIN(PORT_B, 0), 8 }, \ - { GPIO_PIN(PORT_C, 1), 11 },\ - { GPIO_PIN(PORT_C, 0), 10 } \ -} +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_A, 0), 0 }, + { GPIO_PIN(PORT_A, 1), 1 }, + { GPIO_PIN(PORT_A, 4), 4 }, + { GPIO_PIN(PORT_B, 0), 8 }, + { GPIO_PIN(PORT_C, 1), 11 }, + { GPIO_PIN(PORT_C, 0), 10 } +}; -#define ADC_NUMOF (6) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 0b36699d315b7514705fb439882e57d46f573120 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:47:02 +0200 Subject: [PATCH 12/41] boards/nucleo-f091rc: declare adc_config[] directly in periph_conf.h --- boards/nucleo-f091rc/include/periph_conf.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/boards/nucleo-f091rc/include/periph_conf.h b/boards/nucleo-f091rc/include/periph_conf.h index 510ee996fe..19b268a997 100644 --- a/boards/nucleo-f091rc/include/periph_conf.h +++ b/boards/nucleo-f091rc/include/periph_conf.h @@ -208,16 +208,16 @@ static const pwm_conf_t pwm_config[] = { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_A, 0), 0 },\ - { GPIO_PIN(PORT_A, 1), 1 },\ - { GPIO_PIN(PORT_A, 4), 4 },\ - { GPIO_PIN(PORT_B, 0), 8 },\ - { GPIO_PIN(PORT_C, 1), 11 },\ - { GPIO_PIN(PORT_C, 0), 10 } \ -} +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_A, 0), 0 }, + { GPIO_PIN(PORT_A, 1), 1 }, + { GPIO_PIN(PORT_A, 4), 4 }, + { GPIO_PIN(PORT_B, 0), 8 }, + { GPIO_PIN(PORT_C, 1), 11 }, + { GPIO_PIN(PORT_C, 0), 10 } +}; -#define ADC_NUMOF (6) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 2179e38fa88cf1cfef95b70d7528029cfc05706c Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:48:33 +0200 Subject: [PATCH 13/41] boards/nucleo-f207zg: declare adc_config[] directly in periph_conf.h --- boards/nucleo-f207zg/include/periph_conf.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/boards/nucleo-f207zg/include/periph_conf.h b/boards/nucleo-f207zg/include/periph_conf.h index b5dfe7be81..6504e62c97 100644 --- a/boards/nucleo-f207zg/include/periph_conf.h +++ b/boards/nucleo-f207zg/include/periph_conf.h @@ -223,11 +223,12 @@ static const spi_conf_t spi_config[] = { * PIN, device (ADCx), channel * @{ */ -#define ADC_CONFIG { \ - {GPIO_PIN(PORT_A, 3), 0, 3}, \ - {GPIO_PIN(PORT_C, 0), 1, 0} \ -} -#define ADC_NUMOF (2) +static const adc_conf_t adc_config[] = { + {GPIO_PIN(PORT_A, 3), 0, 3}, + {GPIO_PIN(PORT_C, 0), 1, 0} +}; + +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ /** From 0dc1066d57b0f96b53751f5f5b48c52056587338 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:50:19 +0200 Subject: [PATCH 14/41] boards/nucleo-f401re: declare adc_config[] directly in periph_conf.h --- boards/nucleo-f401re/include/periph_conf.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/boards/nucleo-f401re/include/periph_conf.h b/boards/nucleo-f401re/include/periph_conf.h index 0e6a476fe8..d791109ff6 100644 --- a/boards/nucleo-f401re/include/periph_conf.h +++ b/boards/nucleo-f401re/include/periph_conf.h @@ -237,15 +237,16 @@ static const spi_conf_t spi_config[] = { * * @{ */ -#define ADC_NUMOF (6U) -#define ADC_CONFIG { \ - {GPIO_PIN(PORT_A, 0), 0, 0}, \ - {GPIO_PIN(PORT_A, 1), 0, 1}, \ - {GPIO_PIN(PORT_A, 4), 0, 4}, \ - {GPIO_PIN(PORT_B, 0), 0, 8}, \ - {GPIO_PIN(PORT_C, 1), 0, 11}, \ - {GPIO_PIN(PORT_C, 0), 0, 10}, \ -} +static const adc_conf_t adc_config[] = { + {GPIO_PIN(PORT_A, 0), 0, 0}, + {GPIO_PIN(PORT_A, 1), 0, 1}, + {GPIO_PIN(PORT_A, 4), 0, 4}, + {GPIO_PIN(PORT_B, 0), 0, 8}, + {GPIO_PIN(PORT_C, 1), 0, 11}, + {GPIO_PIN(PORT_C, 0), 0, 10}, +}; + +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From e2e54db822e95373da479ec159b4310f92263987 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:51:56 +0200 Subject: [PATCH 15/41] boards/nucleo-f410rb: declare adc_config[] directly in periph_conf.h --- boards/nucleo-f410rb/include/periph_conf.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/boards/nucleo-f410rb/include/periph_conf.h b/boards/nucleo-f410rb/include/periph_conf.h index 4660c3c0d8..0e2d38e6f7 100644 --- a/boards/nucleo-f410rb/include/periph_conf.h +++ b/boards/nucleo-f410rb/include/periph_conf.h @@ -140,15 +140,16 @@ static const spi_conf_t spi_config[] = { * * @{ */ -#define ADC_NUMOF (6U) -#define ADC_CONFIG { \ - {GPIO_PIN(PORT_A, 0), 0, 0}, \ - {GPIO_PIN(PORT_A, 1), 0, 1}, \ - {GPIO_PIN(PORT_A, 4), 0, 4}, \ - {GPIO_PIN(PORT_B, 0), 0, 8}, \ - {GPIO_PIN(PORT_C, 1), 0, 11}, \ - {GPIO_PIN(PORT_C, 0), 0, 10}, \ -} +static const adc_conf_t adc_config[] = { + {GPIO_PIN(PORT_A, 0), 0, 0}, + {GPIO_PIN(PORT_A, 1), 0, 1}, + {GPIO_PIN(PORT_A, 4), 0, 4}, + {GPIO_PIN(PORT_B, 0), 0, 8}, + {GPIO_PIN(PORT_C, 1), 0, 11}, + {GPIO_PIN(PORT_C, 0), 0, 10}, +}; + +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From b77559795b56c21389e3e77d866f9d1c6d466d48 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:53:47 +0200 Subject: [PATCH 16/41] boards/nucleo-f411re: declare adc_config[] directly in periph_conf.h --- boards/nucleo-f411re/include/periph_conf.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/boards/nucleo-f411re/include/periph_conf.h b/boards/nucleo-f411re/include/periph_conf.h index 58b1b57cef..441f1b338a 100644 --- a/boards/nucleo-f411re/include/periph_conf.h +++ b/boards/nucleo-f411re/include/periph_conf.h @@ -169,15 +169,16 @@ static const spi_conf_t spi_config[] = { * * @{ */ -#define ADC_NUMOF (6U) -#define ADC_CONFIG { \ - {GPIO_PIN(PORT_A, 0), 0, 0}, \ - {GPIO_PIN(PORT_A, 1), 0, 1}, \ - {GPIO_PIN(PORT_A, 4), 0, 4}, \ - {GPIO_PIN(PORT_B, 0), 0, 8}, \ - {GPIO_PIN(PORT_C, 1), 0, 11}, \ - {GPIO_PIN(PORT_C, 0), 0, 10}, \ -} +static const adc_conf_t adc_config[] = { + {GPIO_PIN(PORT_A, 0), 0, 0}, + {GPIO_PIN(PORT_A, 1), 0, 1}, + {GPIO_PIN(PORT_A, 4), 0, 4}, + {GPIO_PIN(PORT_B, 0), 0, 8}, + {GPIO_PIN(PORT_C, 1), 0, 11}, + {GPIO_PIN(PORT_C, 0), 0, 10}, +}; + +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 85f2d4bdb7c816e6d2b2e926a74d8a23ec2381c1 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:58:00 +0200 Subject: [PATCH 17/41] boards/nucleo-f412zg: declare adc_config[] directly in periph_conf.h --- boards/nucleo-f412zg/include/periph_conf.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/boards/nucleo-f412zg/include/periph_conf.h b/boards/nucleo-f412zg/include/periph_conf.h index bca5970ed0..285846ec9c 100644 --- a/boards/nucleo-f412zg/include/periph_conf.h +++ b/boards/nucleo-f412zg/include/periph_conf.h @@ -171,15 +171,16 @@ static const spi_conf_t spi_config[] = { * * @{ */ -#define ADC_NUMOF (6U) -#define ADC_CONFIG { \ - {GPIO_PIN(PORT_A, 3), 0, 3}, \ - {GPIO_PIN(PORT_C, 0), 0, 10}, \ - {GPIO_PIN(PORT_C, 3), 0, 13}, \ - {GPIO_PIN(PORT_C, 1), 0, 11}, \ - {GPIO_PIN(PORT_C, 4), 0, 14}, \ - {GPIO_PIN(PORT_C, 5), 0, 15}, \ -} +static const adc_conf_t adc_config[] = { + {GPIO_PIN(PORT_A, 3), 0, 3}, + {GPIO_PIN(PORT_C, 0), 0, 10}, + {GPIO_PIN(PORT_C, 3), 0, 13}, + {GPIO_PIN(PORT_C, 1), 0, 11}, + {GPIO_PIN(PORT_C, 4), 0, 14}, + {GPIO_PIN(PORT_C, 5), 0, 15}, +}; + +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 213c0c0d3491c2cedcd1811339a4f77105298bf5 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:59:09 +0200 Subject: [PATCH 18/41] boards/nucleo-f413zh: declare adc_config[] directly in periph_conf.h --- boards/nucleo-f413zh/include/periph_conf.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/boards/nucleo-f413zh/include/periph_conf.h b/boards/nucleo-f413zh/include/periph_conf.h index 747ba70121..3b7d38b8e3 100644 --- a/boards/nucleo-f413zh/include/periph_conf.h +++ b/boards/nucleo-f413zh/include/periph_conf.h @@ -172,15 +172,16 @@ static const spi_conf_t spi_config[] = { * * @{ */ -#define ADC_NUMOF (6U) -#define ADC_CONFIG { \ - {GPIO_PIN(PORT_A, 3), 0, 3}, \ - {GPIO_PIN(PORT_C, 0), 0, 10}, \ - {GPIO_PIN(PORT_C, 3), 0, 13}, \ - {GPIO_PIN(PORT_C, 1), 0, 11}, \ - {GPIO_PIN(PORT_C, 4), 0, 14}, \ - {GPIO_PIN(PORT_C, 5), 0, 15}, \ -} +static const adc_conf_t adc_config[] = { + {GPIO_PIN(PORT_A, 3), 0, 3}, + {GPIO_PIN(PORT_C, 0), 0, 10}, + {GPIO_PIN(PORT_C, 3), 0, 13}, + {GPIO_PIN(PORT_C, 1), 0, 11}, + {GPIO_PIN(PORT_C, 4), 0, 14}, + {GPIO_PIN(PORT_C, 5), 0, 15}, +}; + +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ /** From a555578c28c66bf744fb471a7e6823e6b971c249 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 15:59:57 +0200 Subject: [PATCH 19/41] boards/nucleo-f429zi: declare adc_config[] directly in periph_conf.h --- boards/nucleo-f429zi/include/periph_conf.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/boards/nucleo-f429zi/include/periph_conf.h b/boards/nucleo-f429zi/include/periph_conf.h index 55094e1304..dc675d42b1 100644 --- a/boards/nucleo-f429zi/include/periph_conf.h +++ b/boards/nucleo-f429zi/include/periph_conf.h @@ -169,15 +169,16 @@ static const spi_conf_t spi_config[] = { * * @{ */ -#define ADC_NUMOF (6U) -#define ADC_CONFIG { \ - {GPIO_PIN(PORT_A, 3), 2, 3}, \ - {GPIO_PIN(PORT_C, 0), 2, 10}, \ - {GPIO_PIN(PORT_C, 3), 2, 13}, \ - {GPIO_PIN(PORT_F, 3), 2, 9}, \ - {GPIO_PIN(PORT_F, 5), 2, 15}, \ - {GPIO_PIN(PORT_F, 10), 2, 8}, \ -} +static const adc_conf_t adc_config[] = { + {GPIO_PIN(PORT_A, 3), 2, 3}, + {GPIO_PIN(PORT_C, 0), 2, 10}, + {GPIO_PIN(PORT_C, 3), 2, 13}, + {GPIO_PIN(PORT_F, 3), 2, 9}, + {GPIO_PIN(PORT_F, 5), 2, 15}, + {GPIO_PIN(PORT_F, 10), 2, 8}, +}; + +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From daecd9c607d766a3f269d0bde389fbb19e250b85 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:01:25 +0200 Subject: [PATCH 20/41] boards/nucleo-f446re: declare adc_config[] directly in periph_conf.h --- boards/nucleo-f446re/include/periph_conf.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/boards/nucleo-f446re/include/periph_conf.h b/boards/nucleo-f446re/include/periph_conf.h index 73b2b55ba1..605477674c 100644 --- a/boards/nucleo-f446re/include/periph_conf.h +++ b/boards/nucleo-f446re/include/periph_conf.h @@ -247,15 +247,16 @@ static const spi_conf_t spi_config[] = { * * @{ */ -#define ADC_NUMOF (6U) -#define ADC_CONFIG { \ - {GPIO_PIN(PORT_A, 0), 0, 0}, \ - {GPIO_PIN(PORT_A, 1), 0, 1}, \ - {GPIO_PIN(PORT_A, 4), 0, 4}, \ - {GPIO_PIN(PORT_B, 0), 0, 8}, \ - {GPIO_PIN(PORT_C, 1), 0, 11}, \ - {GPIO_PIN(PORT_C, 0), 0, 10}, \ -} +static const adc_conf_t adc_config[] = { + {GPIO_PIN(PORT_A, 0), 0, 0}, + {GPIO_PIN(PORT_A, 1), 0, 1}, + {GPIO_PIN(PORT_A, 4), 0, 4}, + {GPIO_PIN(PORT_B, 0), 0, 8}, + {GPIO_PIN(PORT_C, 1), 0, 11}, + {GPIO_PIN(PORT_C, 0), 0, 10}, +}; + +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From fcec19a446f7adf5efba430469b0b1e8d20b441e Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:02:42 +0200 Subject: [PATCH 21/41] boards/nucleo-l031k6: declare adc_config[] directly in periph_conf.h --- boards/nucleo-l031k6/include/periph_conf.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/boards/nucleo-l031k6/include/periph_conf.h b/boards/nucleo-l031k6/include/periph_conf.h index b3e76a5bed..eb8e02035a 100644 --- a/boards/nucleo-l031k6/include/periph_conf.h +++ b/boards/nucleo-l031k6/include/periph_conf.h @@ -102,16 +102,17 @@ static const spi_conf_t spi_config[] = { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_A, 0), 0 }, /* Pin A0 */ \ - { GPIO_PIN(PORT_A, 1), 1 }, /* Pin A1 */ \ - { GPIO_PIN(PORT_A, 3), 3 }, /* Pin A2 */ \ - { GPIO_PIN(PORT_A, 4), 4 }, /* Pin A3 */ \ - { GPIO_PIN(PORT_A, 5), 5 }, /* Pin A4 */ \ - { GPIO_PIN(PORT_A, 6), 6 }, /* Pin A5 */ \ - { GPIO_PIN(PORT_A, 7), 7 }, /* Pin A6 */ \ -} -#define ADC_NUMOF (7U) +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_A, 0), 0 }, /* Pin A0 */ + { GPIO_PIN(PORT_A, 1), 1 }, /* Pin A1 */ + { GPIO_PIN(PORT_A, 3), 3 }, /* Pin A2 */ + { GPIO_PIN(PORT_A, 4), 4 }, /* Pin A3 */ + { GPIO_PIN(PORT_A, 5), 5 }, /* Pin A4 */ + { GPIO_PIN(PORT_A, 6), 6 }, /* Pin A5 */ + { GPIO_PIN(PORT_A, 7), 7 }, /* Pin A6 */ +}; + +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 790b9f5b1a7bed55fabb16697454db9f6a533d3a Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:04:25 +0200 Subject: [PATCH 22/41] boards/nucleo-l073rz: declare adc_config[] directly in periph_conf.h --- boards/nucleo-l073rz/include/periph_conf.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/boards/nucleo-l073rz/include/periph_conf.h b/boards/nucleo-l073rz/include/periph_conf.h index 20e771f633..6bcb2d79a2 100644 --- a/boards/nucleo-l073rz/include/periph_conf.h +++ b/boards/nucleo-l073rz/include/periph_conf.h @@ -132,16 +132,16 @@ static const spi_conf_t spi_config[] = { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_A, 0), 0 }, \ - { GPIO_PIN(PORT_A, 1), 1 }, \ - { GPIO_PIN(PORT_A, 4), 4 }, \ - { GPIO_PIN(PORT_B, 0), 8 }, \ - { GPIO_PIN(PORT_C, 1), 11 },\ - { GPIO_PIN(PORT_C, 0), 10 } \ -} +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_A, 0), 0 }, + { GPIO_PIN(PORT_A, 1), 1 }, + { GPIO_PIN(PORT_A, 4), 4 }, + { GPIO_PIN(PORT_B, 0), 8 }, + { GPIO_PIN(PORT_C, 1), 11 }, + { GPIO_PIN(PORT_C, 0), 10 } +}; -#define ADC_NUMOF (6U) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ /** From cbd60b68a33941b4397f4d46c1b2548234cbde9d Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:05:30 +0200 Subject: [PATCH 23/41] boards/nucleo-l152re: declare adc_config[] directly in periph_conf.h --- boards/nucleo-l152re/include/periph_conf.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/boards/nucleo-l152re/include/periph_conf.h b/boards/nucleo-l152re/include/periph_conf.h index 306c5cc141..713540505c 100644 --- a/boards/nucleo-l152re/include/periph_conf.h +++ b/boards/nucleo-l152re/include/periph_conf.h @@ -236,16 +236,16 @@ static const i2c_conf_t i2c_config[] = { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_A, 0), 0 }, \ - { GPIO_PIN(PORT_A, 1), 1 }, \ - { GPIO_PIN(PORT_A, 4), 4 }, \ - { GPIO_PIN(PORT_B, 0), 8 }, \ - { GPIO_PIN(PORT_C, 1), 11 }, \ - { GPIO_PIN(PORT_C, 0), 10 }, \ -} +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_A, 0), 0 }, + { GPIO_PIN(PORT_A, 1), 1 }, + { GPIO_PIN(PORT_A, 4), 4 }, + { GPIO_PIN(PORT_B, 0), 8 }, + { GPIO_PIN(PORT_C, 1), 11 }, + { GPIO_PIN(PORT_C, 0), 10 }, +}; -#define ADC_NUMOF (6U) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ /** From d1a7ecb60ea47fc33e292ae390a07799a713e22e Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:06:29 +0200 Subject: [PATCH 24/41] boards/nucleo-l476rg: declare adc_config[] directly in periph_conf.h --- boards/nucleo-l476rg/include/periph_conf.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/boards/nucleo-l476rg/include/periph_conf.h b/boards/nucleo-l476rg/include/periph_conf.h index c72582eb8d..e781c5593f 100644 --- a/boards/nucleo-l476rg/include/periph_conf.h +++ b/boards/nucleo-l476rg/include/periph_conf.h @@ -209,15 +209,16 @@ static const spi_conf_t spi_config[] = { * * @{ */ -#define ADC_NUMOF (6U) -#define ADC_CONFIG { \ - {GPIO_PIN(PORT_A, 0), 0, 5}, /*< ADC12_IN5 */ \ - {GPIO_PIN(PORT_A, 1), 0, 6}, /*< ADC12_IN6 */ \ - {GPIO_PIN(PORT_A, 4), 1, 9}, /*< ADC12_IN9 */ \ - {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 */ \ -} +static const adc_conf_t adc_config[] = { + {GPIO_PIN(PORT_A, 0), 0, 5}, /*< ADC12_IN5 */ + {GPIO_PIN(PORT_A, 1), 0, 6}, /*< ADC12_IN6 */ + {GPIO_PIN(PORT_A, 4), 1, 9}, /*< ADC12_IN9 */ + {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 */ +}; + +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 3e2e4c4150c65235bd5d55b9647de23315336d09 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:10:05 +0200 Subject: [PATCH 25/41] boards/olimexino-stm32: declare adc_config[] directly in periph_conf.h --- boards/olimexino-stm32/include/periph_conf.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/boards/olimexino-stm32/include/periph_conf.h b/boards/olimexino-stm32/include/periph_conf.h index 6c356a3c24..effbffbde8 100644 --- a/boards/olimexino-stm32/include/periph_conf.h +++ b/boards/olimexino-stm32/include/periph_conf.h @@ -58,16 +58,16 @@ extern "C" { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_C, 0), 0, 10 }, \ - { GPIO_PIN(PORT_C, 1), 0, 11 }, \ - { GPIO_PIN(PORT_C, 2), 0, 12 }, \ - { GPIO_PIN(PORT_C, 3), 0, 13 }, \ - { GPIO_PIN(PORT_C, 4), 0, 14 }, \ - { GPIO_PIN(PORT_C, 5), 0, 15 } \ -} +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_C, 0), 0, 10 }, + { GPIO_PIN(PORT_C, 1), 0, 11 }, + { GPIO_PIN(PORT_C, 2), 0, 12 }, + { GPIO_PIN(PORT_C, 3), 0, 13 }, + { GPIO_PIN(PORT_C, 4), 0, 14 }, + { GPIO_PIN(PORT_C, 5), 0, 15 } +}; -#define ADC_NUMOF (6) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ /** From 80990e7c9649abdaf91f47b02e41c28fc34088ca Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:11:06 +0200 Subject: [PATCH 26/41] boards/stm32f030f4-demo: declare adc_config[] directly in periph_conf.h --- boards/stm32f030f4-demo/include/periph_conf.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/boards/stm32f030f4-demo/include/periph_conf.h b/boards/stm32f030f4-demo/include/periph_conf.h index 7944efc7d2..5b7fe9e528 100644 --- a/boards/stm32f030f4-demo/include/periph_conf.h +++ b/boards/stm32f030f4-demo/include/periph_conf.h @@ -152,16 +152,16 @@ static const spi_conf_t spi_config[] = { * @name ADC configuration * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_A, 0), 0 }, \ - { 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 } \ -} +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_A, 0), 0 }, + { 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 } +}; -#define ADC_NUMOF (6) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 477e9100660162a08047b61ebdbf25c616dc49c2 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:12:10 +0200 Subject: [PATCH 27/41] boards/stm32f0discovery: declare adc_config[] directly in periph_conf.h --- boards/stm32f0discovery/include/periph_conf.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/boards/stm32f0discovery/include/periph_conf.h b/boards/stm32f0discovery/include/periph_conf.h index 14314992e0..ca14edd96e 100644 --- a/boards/stm32f0discovery/include/periph_conf.h +++ b/boards/stm32f0discovery/include/periph_conf.h @@ -112,16 +112,16 @@ static const uart_conf_t uart_config[] = { * [ pin, channel ] * @{ */ -#define ADC_CONFIG { \ - { GPIO_PIN(PORT_C, 0), 10 },\ - { GPIO_PIN(PORT_C, 1), 11 },\ - { GPIO_PIN(PORT_C, 2), 12 },\ - { GPIO_PIN(PORT_C, 3), 13 },\ - { GPIO_PIN(PORT_C, 4), 14 },\ - { GPIO_PIN(PORT_C, 5), 15 } \ -} +static const adc_conf_t adc_config[] = { + { GPIO_PIN(PORT_C, 0), 10 }, + { GPIO_PIN(PORT_C, 1), 11 }, + { GPIO_PIN(PORT_C, 2), 12 }, + { GPIO_PIN(PORT_C, 3), 13 }, + { GPIO_PIN(PORT_C, 4), 14 }, + { GPIO_PIN(PORT_C, 5), 15 } +}; -#define ADC_NUMOF (6) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ /** From 110c9bb8c1b2490cc242c50a4d13001f3ad303ee Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:14:22 +0200 Subject: [PATCH 28/41] boards/stm32f4discovery: declare adc_config[] directly in periph_conf.h --- boards/stm32f4discovery/include/periph_conf.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/boards/stm32f4discovery/include/periph_conf.h b/boards/stm32f4discovery/include/periph_conf.h index 72580adc99..00f43e38eb 100644 --- a/boards/stm32f4discovery/include/periph_conf.h +++ b/boards/stm32f4discovery/include/periph_conf.h @@ -122,14 +122,14 @@ static const uart_conf_t uart_config[] = { * PIN, device (ADCx), channel * @{ */ -#define 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} \ -} +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} +}; -#define ADC_NUMOF (4) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ /** From 0943d12bb1c0e150a7b2cdfd5420acb172541f58 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:16:44 +0200 Subject: [PATCH 29/41] boards/ublox-c030-u201: declare adc_config[] directly in periph_conf.h --- boards/ublox-c030-u201/include/periph_conf.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/boards/ublox-c030-u201/include/periph_conf.h b/boards/ublox-c030-u201/include/periph_conf.h index 15a33512c6..714c5d82ce 100644 --- a/boards/ublox-c030-u201/include/periph_conf.h +++ b/boards/ublox-c030-u201/include/periph_conf.h @@ -243,15 +243,16 @@ static const i2c_conf_t i2c_config[] = { * * @{ */ -#define ADC_NUMOF (6U) -#define ADC_CONFIG { \ - {GPIO_PIN(PORT_A, 3), 0, 3}, \ - {GPIO_PIN(PORT_C, 0), 0, 10}, \ - {GPIO_PIN(PORT_C, 3), 0, 4}, \ - {GPIO_PIN(PORT_A, 4), 0, 14}, \ - {GPIO_PIN(PORT_B, 7), 0, 7}, \ - {GPIO_PIN(PORT_B, 6), 0, 6}, \ -} +static const adc_conf_t adc_config[] = { + {GPIO_PIN(PORT_A, 3), 0, 3}, + {GPIO_PIN(PORT_C, 0), 0, 10}, + {GPIO_PIN(PORT_C, 3), 0, 4}, + {GPIO_PIN(PORT_A, 4), 0, 14}, + {GPIO_PIN(PORT_B, 7), 0, 7}, + {GPIO_PIN(PORT_B, 6), 0, 6}, +}; + +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 394ccfde0b1ce4b16b35a1b455d5d3236aa35a72 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:19:27 +0200 Subject: [PATCH 30/41] boards/weact-f411ce: declare adc_config[] directly in periph_conf.h --- boards/weact-f411ce/include/periph_conf.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/boards/weact-f411ce/include/periph_conf.h b/boards/weact-f411ce/include/periph_conf.h index 698e5e956c..45a4cb4f0e 100644 --- a/boards/weact-f411ce/include/periph_conf.h +++ b/boards/weact-f411ce/include/periph_conf.h @@ -162,15 +162,14 @@ static const spi_conf_t spi_config[] = { * * @{ */ +static const adc_conf_t adc_config[] = { + {GPIO_PIN(PORT_A, 0), 0, 0}, + {GPIO_PIN(PORT_A, 1), 0, 1}, + {GPIO_PIN(PORT_A, 4), 0, 4}, + {GPIO_PIN(PORT_B, 0), 0, 8}, +}; -#define ADC_CONFIG { \ - {GPIO_PIN(PORT_A, 0), 0, 0}, \ - {GPIO_PIN(PORT_A, 1), 0, 1}, \ - {GPIO_PIN(PORT_A, 4), 0, 4}, \ - {GPIO_PIN(PORT_B, 0), 0, 8}, \ -} - -#define ADC_NUMOF (4) +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 1a6f8df3cccadab747bc7eb8c96dcba6e11363d0 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:21:01 +0200 Subject: [PATCH 31/41] boards/yunjia-nrf51822: declare adc_config[] directly in periph_conf.h --- boards/yunjia-nrf51822/include/periph_conf.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/boards/yunjia-nrf51822/include/periph_conf.h b/boards/yunjia-nrf51822/include/periph_conf.h index affd910217..42fbe0650e 100644 --- a/boards/yunjia-nrf51822/include/periph_conf.h +++ b/boards/yunjia-nrf51822/include/periph_conf.h @@ -83,8 +83,9 @@ static const i2c_conf_t i2c_config[] = { * The configuration consists simply of a list of channels that should be used * @{ */ -#define ADC_CONFIG {4, 5, 6, 7} -#define ADC_NUMOF (4) +static const adc_conf_t adc_config[] = {4, 5, 6, 7}; + +#define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ #ifdef __cplusplus From 3921a2f925ec74e41ecad427216f90f99d263389 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:31:28 +0200 Subject: [PATCH 32/41] cpu/stm32/periph/adc_l1: removes ADC configuration loading --- cpu/stm32/periph/adc_l1.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cpu/stm32/periph/adc_l1.c b/cpu/stm32/periph/adc_l1.c index 77593532f5..d7c97003c4 100644 --- a/cpu/stm32/periph/adc_l1.c +++ b/cpu/stm32/periph/adc_l1.c @@ -47,11 +47,6 @@ #define ADC_SAMPLE_TIME_192C (6) #define ADC_SAMPLE_TIME_384C (7) -/** - * @brief Load the ADC configuration - */ -static const adc_conf_t adc_config[] = ADC_CONFIG; - /** * @brief Allocate locks for all three available ADC device * From 323725bcf5fbfb65c8e962f431279f5ac4eabd89 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:32:21 +0200 Subject: [PATCH 33/41] cpu/stm32/periph/adc_f4: removes ADC configuration loading --- cpu/stm32/periph/adc_f4.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cpu/stm32/periph/adc_f4.c b/cpu/stm32/periph/adc_f4.c index e9c43c31db..378cb26144 100644 --- a/cpu/stm32/periph/adc_f4.c +++ b/cpu/stm32/periph/adc_f4.c @@ -29,11 +29,6 @@ */ #define MAX_ADC_SPEED (12000000U) -/** - * @brief Load the ADC configuration - */ -static const adc_conf_t adc_config[] = ADC_CONFIG; - /** * @brief Allocate locks for all three available ADC devices */ From 7680c8e2cb0206747e75c15bf634b8ad4c7337f4 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:32:39 +0200 Subject: [PATCH 34/41] cpu/stm32/periph/adc_f1: removes ADC configuration loading --- cpu/stm32/periph/adc_f1.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cpu/stm32/periph/adc_f1.c b/cpu/stm32/periph/adc_f1.c index 8bd42a95c0..2323598137 100644 --- a/cpu/stm32/periph/adc_f1.c +++ b/cpu/stm32/periph/adc_f1.c @@ -30,11 +30,6 @@ */ #define MAX_ADC_SPEED (14000000U) -/** - * @brief Load the ADC configuration - */ -static const adc_conf_t adc_config[] = ADC_CONFIG; - /** * @brief Allocate locks for all three available ADC devices */ From 05702d55931383326e6243eefe4e571b7ec8ce63 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:32:50 +0200 Subject: [PATCH 35/41] cpu/stm32/periph/adc_f2: removes ADC configuration loading --- cpu/stm32/periph/adc_f2.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/cpu/stm32/periph/adc_f2.c b/cpu/stm32/periph/adc_f2.c index e622b51ab6..3136e5ee6e 100644 --- a/cpu/stm32/periph/adc_f2.c +++ b/cpu/stm32/periph/adc_f2.c @@ -30,16 +30,6 @@ */ #define MAX_ADC_SPEED (12000000U) -/** - * @brief Load the ADC configuration - * @{ - */ -#ifdef ADC_CONFIG -static const adc_conf_t adc_config[] = ADC_CONFIG; -#else -static const adc_conf_t adc_config[] = {}; -#endif - /** * @brief Allocate locks for all three available ADC devices */ From 779d7a3b00e92b7ae795d59d7a45004a41c58759 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:33:37 +0200 Subject: [PATCH 36/41] cpu/stm32/periph/adc_l4: removes ADC configuration loading --- cpu/stm32/periph/adc_l4.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cpu/stm32/periph/adc_l4.c b/cpu/stm32/periph/adc_l4.c index 4c142ea36c..5b637d640f 100644 --- a/cpu/stm32/periph/adc_l4.c +++ b/cpu/stm32/periph/adc_l4.c @@ -55,11 +55,6 @@ #define ADC_SMPR2_FIRST_CHAN (10) #endif -/** - * @brief Load the ADC configuration - */ -static const adc_conf_t adc_config[] = ADC_CONFIG; - /** * @brief Allocate locks for all three available ADC devices */ From 5a26f741248eaa2b3f857df244d61f25b9c2a3bf Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:33:50 +0200 Subject: [PATCH 37/41] cpu/stm32/periph/adc_l0: removes ADC configuration loading --- cpu/stm32/periph/adc_l0.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cpu/stm32/periph/adc_l0.c b/cpu/stm32/periph/adc_l0.c index 682f302ad8..e56d953f87 100644 --- a/cpu/stm32/periph/adc_l0.c +++ b/cpu/stm32/periph/adc_l0.c @@ -23,11 +23,6 @@ #include "mutex.h" #include "periph/adc.h" -/** - * @brief Load the ADC configuration - */ -static const adc_conf_t adc_config[] = ADC_CONFIG; - /** * @brief Allocate locks for all three available ADC device * From 07cdad29d70dc8d7819b81f5b72f2305199d18ef Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:34:07 +0200 Subject: [PATCH 38/41] cpu/stm32/periph/adc_f0: removes ADC configuration loading --- cpu/stm32/periph/adc_f0.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cpu/stm32/periph/adc_f0.c b/cpu/stm32/periph/adc_f0.c index 9806d2eb7f..16e5f8d7bd 100644 --- a/cpu/stm32/periph/adc_f0.c +++ b/cpu/stm32/periph/adc_f0.c @@ -23,11 +23,6 @@ #include "mutex.h" #include "periph/adc.h" -/** - * @brief Load the ADC configuration - */ -static const adc_conf_t adc_config[] = ADC_CONFIG; - /** * @brief Allocate locks for all three available ADC device * From 692f99989a779ae4a3c6df5825d4523808a5dc98 Mon Sep 17 00:00:00 2001 From: hugues Date: Tue, 25 Aug 2020 16:35:09 +0200 Subject: [PATCH 39/41] cpu/nrf51/periph/adc: removes ADC configuration loading --- cpu/nrf51/periph/adc.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cpu/nrf51/periph/adc.c b/cpu/nrf51/periph/adc.c index 996b3f943f..d17fee83c9 100644 --- a/cpu/nrf51/periph/adc.c +++ b/cpu/nrf51/periph/adc.c @@ -23,11 +23,6 @@ #include "periph/adc.h" #include "periph_conf.h" -/** - * @brief Load the ADC configuration - */ -static const uint8_t adc_config[] = ADC_CONFIG; - /** * @brief Lock to prevent concurrency issues when used from different threads */ From 4c4b754e1c6db2346f47309c11f28d0d6479451f Mon Sep 17 00:00:00 2001 From: hugues Date: Thu, 27 Aug 2020 11:43:22 +0200 Subject: [PATCH 40/41] cpu/nrf51/include/periph_cpu.h: add adc_conf_t typedef --- cpu/nrf51/include/periph_cpu.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cpu/nrf51/include/periph_cpu.h b/cpu/nrf51/include/periph_cpu.h index 79292b9469..371bf353d3 100644 --- a/cpu/nrf51/include/periph_cpu.h +++ b/cpu/nrf51/include/periph_cpu.h @@ -83,6 +83,11 @@ typedef enum { /** @} */ #endif /* ndef DOXYGEN */ +/** + * @brief ADC configuration wrapper + */ +typedef gpio_t adc_conf_t; + /** * @brief I2C (TWI) configuration options */ From 228a71f96e897270287d225620b6dd97c02ed5d2 Mon Sep 17 00:00:00 2001 From: hugues Date: Thu, 27 Aug 2020 23:27:42 +0200 Subject: [PATCH 41/41] boards/common/blxxxpill/include/periph_conf.h: reorder adc_config[] --- boards/common/blxxxpill/include/periph_conf.h | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/boards/common/blxxxpill/include/periph_conf.h b/boards/common/blxxxpill/include/periph_conf.h index 5ce6e6363e..2e813b07eb 100644 --- a/boards/common/blxxxpill/include/periph_conf.h +++ b/boards/common/blxxxpill/include/periph_conf.h @@ -73,18 +73,18 @@ extern "C" { * @{ */ static const adc_conf_t adc_config[] = { - { .dev = 0, .pin = GPIO_PIN(PORT_A, 0), .chan = 0 }, - { .dev = 0, .pin = GPIO_PIN(PORT_A, 1), .chan = 1 }, - { .dev = 0, .pin = GPIO_PIN(PORT_A, 4), .chan = 4 }, - { .dev = 0, .pin = GPIO_PIN(PORT_A, 5), .chan = 5 }, - { .dev = 0, .pin = GPIO_PIN(PORT_A, 6), .chan = 6 }, - { .dev = 0, .pin = GPIO_PIN(PORT_A, 7), .chan = 7 }, - { .dev = 0, .pin = GPIO_PIN(PORT_B, 0), .chan = 8 }, - { .dev = 0, .pin = GPIO_PIN(PORT_B, 1), .chan = 9 }, + { .pin = GPIO_PIN(PORT_A, 0), .dev = 0, .chan = 0 }, + { .pin = GPIO_PIN(PORT_A, 1), .dev = 0, .chan = 1 }, + { .pin = GPIO_PIN(PORT_A, 4), .dev = 0, .chan = 4 }, + { .pin = GPIO_PIN(PORT_A, 5), .dev = 0, .chan = 5 }, + { .pin = GPIO_PIN(PORT_A, 6), .dev = 0, .chan = 6 }, + { .pin = GPIO_PIN(PORT_A, 7), .dev = 0, .chan = 7 }, + { .pin = GPIO_PIN(PORT_B, 0), .dev = 0, .chan = 8 }, + { .pin = GPIO_PIN(PORT_B, 1), .dev = 0, .chan = 9 }, /* ADC Temperature channel */ - { .dev = 0, .pin = GPIO_UNDEF, .chan = 16 }, + { .pin = GPIO_UNDEF, .dev = 0, .chan = 16 }, /* ADC VREF channel */ - { .dev = 0, .pin = GPIO_UNDEF, .chan = 17 }, + { .pin = GPIO_UNDEF, .dev = 0, .chan = 17 }, }; #define ADC_NUMOF ARRAY_SIZE(adc_config)