1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #14846 from hugueslarrive/adc_config

Declare adc_config[] like others peripherals configuration arrays
This commit is contained in:
Alexandre Abadie 2020-08-28 09:59:21 +02:00 committed by GitHub
commit 7eed33bf78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 275 additions and 302 deletions

View File

@ -86,8 +86,9 @@ static const i2c_conf_t i2c_config[] = {
* The configuration consists simply of a list of channels that should be used * The configuration consists simply of a list of channels that should be used
* @{ * @{
*/ */
#define ADC_CONFIG {3, 4, 5, 6} static const adc_conf_t adc_config[] = {3, 4, 5, 6};
#define ADC_NUMOF (4)
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -72,22 +72,22 @@ extern "C" {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ .dev = 0, .pin = GPIO_PIN(PORT_A, 0), .chan = 0 }, \ { .pin = GPIO_PIN(PORT_A, 0), .dev = 0, .chan = 0 },
{ .dev = 0, .pin = GPIO_PIN(PORT_A, 1), .chan = 1 }, \ { .pin = GPIO_PIN(PORT_A, 1), .dev = 0, .chan = 1 },
{ .dev = 0, .pin = GPIO_PIN(PORT_A, 4), .chan = 4 }, \ { .pin = GPIO_PIN(PORT_A, 4), .dev = 0, .chan = 4 },
{ .dev = 0, .pin = GPIO_PIN(PORT_A, 5), .chan = 5 }, \ { .pin = GPIO_PIN(PORT_A, 5), .dev = 0, .chan = 5 },
{ .dev = 0, .pin = GPIO_PIN(PORT_A, 6), .chan = 6 }, \ { .pin = GPIO_PIN(PORT_A, 6), .dev = 0, .chan = 6 },
{ .dev = 0, .pin = GPIO_PIN(PORT_A, 7), .chan = 7 }, \ { .pin = GPIO_PIN(PORT_A, 7), .dev = 0, .chan = 7 },
{ .dev = 0, .pin = GPIO_PIN(PORT_B, 0), .chan = 8 }, \ { .pin = GPIO_PIN(PORT_B, 0), .dev = 0, .chan = 8 },
{ .dev = 0, .pin = GPIO_PIN(PORT_B, 1), .chan = 9 }, \ { .pin = GPIO_PIN(PORT_B, 1), .dev = 0, .chan = 9 },
/* ADC Temperature channel */ \ /* ADC Temperature channel */
{ .dev = 0, .pin = GPIO_UNDEF, .chan = 16 }, \ { .pin = GPIO_UNDEF, .dev = 0, .chan = 16 },
/* ADC VREF channel */ \ /* ADC VREF channel */
{ .dev = 0, .pin = GPIO_UNDEF, .chan = 17 }, \ { .pin = GPIO_UNDEF, .dev = 0, .chan = 17 },
} };
#define ADC_NUMOF 10 #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
/** /**

View File

@ -60,12 +60,13 @@ extern "C" {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_A,3), 0, 3 }, \ { GPIO_PIN(PORT_A,3), 0, 3 },
{ GPIO_UNDEF , 0, 16 }, \ { GPIO_UNDEF , 0, 16 },
{ GPIO_UNDEF , 0, 17 } } { GPIO_UNDEF , 0, 17 }
};
#define ADC_NUMOF (3) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
/** /**

View File

@ -161,17 +161,17 @@ static const i2c_conf_t i2c_config[] = {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_A, 0), 0 }, /* P14 */ \ { GPIO_PIN(PORT_A, 0), 0 }, /* P14 */
{ GPIO_PIN(PORT_A, 1), 1 }, /* P15 */ \ { GPIO_PIN(PORT_A, 1), 1 }, /* P15 */
{ GPIO_PIN(PORT_A, 3), 3 }, /* P17 */ \ { GPIO_PIN(PORT_A, 3), 3 }, /* P17 */
/* ADC Temperature channel */ \ /* ADC Temperature channel */
{ GPIO_UNDEF, 16 }, \ { GPIO_UNDEF, 16 },
/* ADC VREF channel */ \ /* ADC VREF channel */
{ GPIO_UNDEF, 17 }, \ { GPIO_UNDEF, 17 },
} };
#define ADC_NUMOF (5) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -95,12 +95,12 @@ static const pwm_conf_t pwm_config[] = {
* PIN, device (ADCx), channel * PIN, device (ADCx), channel
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{GPIO_PIN(PORT_B, 0), 0, 8}, \ {GPIO_PIN(PORT_B, 0), 0, 8},
{GPIO_PIN(PORT_B, 1), 0, 9} \ {GPIO_PIN(PORT_B, 1), 0, 9}
} };
#define ADC_NUMOF (2) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
/** /**

View File

@ -177,16 +177,16 @@ static const spi_conf_t spi_config[] = {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_A, 0), 0 }, \ { GPIO_PIN(PORT_A, 0), 0 },
{ GPIO_PIN(PORT_A, 1), 1 }, \ { GPIO_PIN(PORT_A, 1), 1 },
{ GPIO_PIN(PORT_A, 4), 4 }, \ { GPIO_PIN(PORT_A, 4), 4 },
{ GPIO_PIN(PORT_B, 0), 8 }, \ { GPIO_PIN(PORT_B, 0), 8 },
{ GPIO_PIN(PORT_C, 1), 11 },\ { GPIO_PIN(PORT_C, 1), 11 },
{ GPIO_PIN(PORT_C, 0), 10 } \ { GPIO_PIN(PORT_C, 0), 10 }
} };
#define ADC_NUMOF (6) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -144,15 +144,15 @@ static const spi_conf_t spi_config[] = {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_A, 0), 0 }, \ { GPIO_PIN(PORT_A, 0), 0 },
{ GPIO_PIN(PORT_A, 1), 1 }, \ { GPIO_PIN(PORT_A, 1), 1 },
{ GPIO_PIN(PORT_A, 3), 3 }, \ { GPIO_PIN(PORT_A, 3), 3 },
{ GPIO_PIN(PORT_A, 4), 4 }, \ { GPIO_PIN(PORT_A, 4), 4 },
{ GPIO_PIN(PORT_A, 7), 7 } \ { GPIO_PIN(PORT_A, 7), 7 }
} };
#define ADC_NUMOF (5) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -154,15 +154,15 @@ static const spi_conf_t spi_config[] = {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_A, 0), 0 }, \ { GPIO_PIN(PORT_A, 0), 0 },
{ GPIO_PIN(PORT_A, 1), 1 }, \ { GPIO_PIN(PORT_A, 1), 1 },
{ GPIO_PIN(PORT_A, 3), 3 }, \ { GPIO_PIN(PORT_A, 3), 3 },
{ GPIO_PIN(PORT_A, 4), 4 }, \ { GPIO_PIN(PORT_A, 4), 4 },
{ GPIO_PIN(PORT_A, 7), 7 } \ { GPIO_PIN(PORT_A, 7), 7 }
} };
#define ADC_NUMOF (5) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -154,16 +154,16 @@ static const pwm_conf_t pwm_config[] = {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_A, 0), 0 },\ { GPIO_PIN(PORT_A, 0), 0 },
{ GPIO_PIN(PORT_A, 1), 1 },\ { GPIO_PIN(PORT_A, 1), 1 },
{ GPIO_PIN(PORT_A, 4), 4 },\ { GPIO_PIN(PORT_A, 4), 4 },
{ GPIO_PIN(PORT_B, 0), 8 },\ { GPIO_PIN(PORT_B, 0), 8 },
{ GPIO_PIN(PORT_C, 1), 11 },\ { GPIO_PIN(PORT_C, 1), 11 },
{ GPIO_PIN(PORT_C, 0), 10 } \ { GPIO_PIN(PORT_C, 0), 10 }
} };
#define ADC_NUMOF (6) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -198,16 +198,16 @@ static const spi_conf_t spi_config[] = {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_A, 0), 0 }, \ { GPIO_PIN(PORT_A, 0), 0 },
{ GPIO_PIN(PORT_A, 1), 1 }, \ { GPIO_PIN(PORT_A, 1), 1 },
{ GPIO_PIN(PORT_A, 4), 4 }, \ { GPIO_PIN(PORT_A, 4), 4 },
{ GPIO_PIN(PORT_B, 0), 8 }, \ { GPIO_PIN(PORT_B, 0), 8 },
{ GPIO_PIN(PORT_C, 1), 11 },\ { GPIO_PIN(PORT_C, 1), 11 },
{ GPIO_PIN(PORT_C, 0), 10 } \ { GPIO_PIN(PORT_C, 0), 10 }
} };
#define ADC_NUMOF (6) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -208,16 +208,16 @@ static const pwm_conf_t pwm_config[] = {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_A, 0), 0 },\ { GPIO_PIN(PORT_A, 0), 0 },
{ GPIO_PIN(PORT_A, 1), 1 },\ { GPIO_PIN(PORT_A, 1), 1 },
{ GPIO_PIN(PORT_A, 4), 4 },\ { GPIO_PIN(PORT_A, 4), 4 },
{ GPIO_PIN(PORT_B, 0), 8 },\ { GPIO_PIN(PORT_B, 0), 8 },
{ GPIO_PIN(PORT_C, 1), 11 },\ { GPIO_PIN(PORT_C, 1), 11 },
{ GPIO_PIN(PORT_C, 0), 10 } \ { GPIO_PIN(PORT_C, 0), 10 }
} };
#define ADC_NUMOF (6) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -223,11 +223,12 @@ static const spi_conf_t spi_config[] = {
* PIN, device (ADCx), channel * PIN, device (ADCx), channel
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{GPIO_PIN(PORT_A, 3), 0, 3}, \ {GPIO_PIN(PORT_A, 3), 0, 3},
{GPIO_PIN(PORT_C, 0), 1, 0} \ {GPIO_PIN(PORT_C, 0), 1, 0}
} };
#define ADC_NUMOF (2)
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
/** /**

View File

@ -237,15 +237,16 @@ static const spi_conf_t spi_config[] = {
* *
* @{ * @{
*/ */
#define ADC_NUMOF (6U) static const adc_conf_t adc_config[] = {
#define ADC_CONFIG { \ {GPIO_PIN(PORT_A, 0), 0, 0},
{GPIO_PIN(PORT_A, 0), 0, 0}, \ {GPIO_PIN(PORT_A, 1), 0, 1},
{GPIO_PIN(PORT_A, 1), 0, 1}, \ {GPIO_PIN(PORT_A, 4), 0, 4},
{GPIO_PIN(PORT_A, 4), 0, 4}, \ {GPIO_PIN(PORT_B, 0), 0, 8},
{GPIO_PIN(PORT_B, 0), 0, 8}, \ {GPIO_PIN(PORT_C, 1), 0, 11},
{GPIO_PIN(PORT_C, 1), 0, 11}, \ {GPIO_PIN(PORT_C, 0), 0, 10},
{GPIO_PIN(PORT_C, 0), 0, 10}, \ };
}
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -140,15 +140,16 @@ static const spi_conf_t spi_config[] = {
* *
* @{ * @{
*/ */
#define ADC_NUMOF (6U) static const adc_conf_t adc_config[] = {
#define ADC_CONFIG { \ {GPIO_PIN(PORT_A, 0), 0, 0},
{GPIO_PIN(PORT_A, 0), 0, 0}, \ {GPIO_PIN(PORT_A, 1), 0, 1},
{GPIO_PIN(PORT_A, 1), 0, 1}, \ {GPIO_PIN(PORT_A, 4), 0, 4},
{GPIO_PIN(PORT_A, 4), 0, 4}, \ {GPIO_PIN(PORT_B, 0), 0, 8},
{GPIO_PIN(PORT_B, 0), 0, 8}, \ {GPIO_PIN(PORT_C, 1), 0, 11},
{GPIO_PIN(PORT_C, 1), 0, 11}, \ {GPIO_PIN(PORT_C, 0), 0, 10},
{GPIO_PIN(PORT_C, 0), 0, 10}, \ };
}
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -169,15 +169,16 @@ static const spi_conf_t spi_config[] = {
* *
* @{ * @{
*/ */
#define ADC_NUMOF (6U) static const adc_conf_t adc_config[] = {
#define ADC_CONFIG { \ {GPIO_PIN(PORT_A, 0), 0, 0},
{GPIO_PIN(PORT_A, 0), 0, 0}, \ {GPIO_PIN(PORT_A, 1), 0, 1},
{GPIO_PIN(PORT_A, 1), 0, 1}, \ {GPIO_PIN(PORT_A, 4), 0, 4},
{GPIO_PIN(PORT_A, 4), 0, 4}, \ {GPIO_PIN(PORT_B, 0), 0, 8},
{GPIO_PIN(PORT_B, 0), 0, 8}, \ {GPIO_PIN(PORT_C, 1), 0, 11},
{GPIO_PIN(PORT_C, 1), 0, 11}, \ {GPIO_PIN(PORT_C, 0), 0, 10},
{GPIO_PIN(PORT_C, 0), 0, 10}, \ };
}
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -171,15 +171,16 @@ static const spi_conf_t spi_config[] = {
* *
* @{ * @{
*/ */
#define ADC_NUMOF (6U) static const adc_conf_t adc_config[] = {
#define ADC_CONFIG { \ {GPIO_PIN(PORT_A, 3), 0, 3},
{GPIO_PIN(PORT_A, 3), 0, 3}, \ {GPIO_PIN(PORT_C, 0), 0, 10},
{GPIO_PIN(PORT_C, 0), 0, 10}, \ {GPIO_PIN(PORT_C, 3), 0, 13},
{GPIO_PIN(PORT_C, 3), 0, 13}, \ {GPIO_PIN(PORT_C, 1), 0, 11},
{GPIO_PIN(PORT_C, 1), 0, 11}, \ {GPIO_PIN(PORT_C, 4), 0, 14},
{GPIO_PIN(PORT_C, 4), 0, 14}, \ {GPIO_PIN(PORT_C, 5), 0, 15},
{GPIO_PIN(PORT_C, 5), 0, 15}, \ };
}
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -172,15 +172,16 @@ static const spi_conf_t spi_config[] = {
* *
* @{ * @{
*/ */
#define ADC_NUMOF (6U) static const adc_conf_t adc_config[] = {
#define ADC_CONFIG { \ {GPIO_PIN(PORT_A, 3), 0, 3},
{GPIO_PIN(PORT_A, 3), 0, 3}, \ {GPIO_PIN(PORT_C, 0), 0, 10},
{GPIO_PIN(PORT_C, 0), 0, 10}, \ {GPIO_PIN(PORT_C, 3), 0, 13},
{GPIO_PIN(PORT_C, 3), 0, 13}, \ {GPIO_PIN(PORT_C, 1), 0, 11},
{GPIO_PIN(PORT_C, 1), 0, 11}, \ {GPIO_PIN(PORT_C, 4), 0, 14},
{GPIO_PIN(PORT_C, 4), 0, 14}, \ {GPIO_PIN(PORT_C, 5), 0, 15},
{GPIO_PIN(PORT_C, 5), 0, 15}, \ };
}
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
/** /**

View File

@ -169,15 +169,16 @@ static const spi_conf_t spi_config[] = {
* *
* @{ * @{
*/ */
#define ADC_NUMOF (6U) static const adc_conf_t adc_config[] = {
#define ADC_CONFIG { \ {GPIO_PIN(PORT_A, 3), 2, 3},
{GPIO_PIN(PORT_A, 3), 2, 3}, \ {GPIO_PIN(PORT_C, 0), 2, 10},
{GPIO_PIN(PORT_C, 0), 2, 10}, \ {GPIO_PIN(PORT_C, 3), 2, 13},
{GPIO_PIN(PORT_C, 3), 2, 13}, \ {GPIO_PIN(PORT_F, 3), 2, 9},
{GPIO_PIN(PORT_F, 3), 2, 9}, \ {GPIO_PIN(PORT_F, 5), 2, 15},
{GPIO_PIN(PORT_F, 5), 2, 15}, \ {GPIO_PIN(PORT_F, 10), 2, 8},
{GPIO_PIN(PORT_F, 10), 2, 8}, \ };
}
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -247,15 +247,16 @@ static const spi_conf_t spi_config[] = {
* *
* @{ * @{
*/ */
#define ADC_NUMOF (6U) static const adc_conf_t adc_config[] = {
#define ADC_CONFIG { \ {GPIO_PIN(PORT_A, 0), 0, 0},
{GPIO_PIN(PORT_A, 0), 0, 0}, \ {GPIO_PIN(PORT_A, 1), 0, 1},
{GPIO_PIN(PORT_A, 1), 0, 1}, \ {GPIO_PIN(PORT_A, 4), 0, 4},
{GPIO_PIN(PORT_A, 4), 0, 4}, \ {GPIO_PIN(PORT_B, 0), 0, 8},
{GPIO_PIN(PORT_B, 0), 0, 8}, \ {GPIO_PIN(PORT_C, 1), 0, 11},
{GPIO_PIN(PORT_C, 1), 0, 11}, \ {GPIO_PIN(PORT_C, 0), 0, 10},
{GPIO_PIN(PORT_C, 0), 0, 10}, \ };
}
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -102,16 +102,17 @@ static const spi_conf_t spi_config[] = {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_A, 0), 0 }, /* Pin A0 */ \ { GPIO_PIN(PORT_A, 0), 0 }, /* Pin A0 */
{ GPIO_PIN(PORT_A, 1), 1 }, /* Pin A1 */ \ { GPIO_PIN(PORT_A, 1), 1 }, /* Pin A1 */
{ GPIO_PIN(PORT_A, 3), 3 }, /* Pin A2 */ \ { GPIO_PIN(PORT_A, 3), 3 }, /* Pin A2 */
{ GPIO_PIN(PORT_A, 4), 4 }, /* Pin A3 */ \ { GPIO_PIN(PORT_A, 4), 4 }, /* Pin A3 */
{ GPIO_PIN(PORT_A, 5), 5 }, /* Pin A4 */ \ { GPIO_PIN(PORT_A, 5), 5 }, /* Pin A4 */
{ GPIO_PIN(PORT_A, 6), 6 }, /* Pin A5 */ \ { GPIO_PIN(PORT_A, 6), 6 }, /* Pin A5 */
{ GPIO_PIN(PORT_A, 7), 7 }, /* Pin A6 */ \ { GPIO_PIN(PORT_A, 7), 7 }, /* Pin A6 */
} };
#define ADC_NUMOF (7U)
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -132,16 +132,16 @@ static const spi_conf_t spi_config[] = {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_A, 0), 0 }, \ { GPIO_PIN(PORT_A, 0), 0 },
{ GPIO_PIN(PORT_A, 1), 1 }, \ { GPIO_PIN(PORT_A, 1), 1 },
{ GPIO_PIN(PORT_A, 4), 4 }, \ { GPIO_PIN(PORT_A, 4), 4 },
{ GPIO_PIN(PORT_B, 0), 8 }, \ { GPIO_PIN(PORT_B, 0), 8 },
{ GPIO_PIN(PORT_C, 1), 11 },\ { GPIO_PIN(PORT_C, 1), 11 },
{ GPIO_PIN(PORT_C, 0), 10 } \ { GPIO_PIN(PORT_C, 0), 10 }
} };
#define ADC_NUMOF (6U) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
/** /**

View File

@ -236,16 +236,16 @@ static const i2c_conf_t i2c_config[] = {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_A, 0), 0 }, \ { GPIO_PIN(PORT_A, 0), 0 },
{ GPIO_PIN(PORT_A, 1), 1 }, \ { GPIO_PIN(PORT_A, 1), 1 },
{ GPIO_PIN(PORT_A, 4), 4 }, \ { GPIO_PIN(PORT_A, 4), 4 },
{ GPIO_PIN(PORT_B, 0), 8 }, \ { GPIO_PIN(PORT_B, 0), 8 },
{ GPIO_PIN(PORT_C, 1), 11 }, \ { GPIO_PIN(PORT_C, 1), 11 },
{ GPIO_PIN(PORT_C, 0), 10 }, \ { GPIO_PIN(PORT_C, 0), 10 },
} };
#define ADC_NUMOF (6U) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
/** /**

View File

@ -209,15 +209,16 @@ static const spi_conf_t spi_config[] = {
* *
* @{ * @{
*/ */
#define ADC_NUMOF (6U) static const adc_conf_t adc_config[] = {
#define ADC_CONFIG { \ {GPIO_PIN(PORT_A, 0), 0, 5}, /*< ADC12_IN5 */
{GPIO_PIN(PORT_A, 0), 0, 5}, /*< ADC12_IN5 */ \ {GPIO_PIN(PORT_A, 1), 0, 6}, /*< ADC12_IN6 */
{GPIO_PIN(PORT_A, 1), 0, 6}, /*< ADC12_IN6 */ \ {GPIO_PIN(PORT_A, 4), 1, 9}, /*< ADC12_IN9 */
{GPIO_PIN(PORT_A, 4), 1, 9}, /*< ADC12_IN9 */ \ {GPIO_PIN(PORT_B, 0), 1, 15}, /*< ADC12_IN15 */
{GPIO_PIN(PORT_B, 0), 1, 15}, /*< ADC12_IN15 */ \ {GPIO_PIN(PORT_C, 1), 2, 2}, /*< ADC123_IN_2 */
{GPIO_PIN(PORT_C, 1), 2, 2}, /*< ADC123_IN_2 */ \ {GPIO_PIN(PORT_C, 0), 2, 1}, /*< ADC123_IN_1 */
{GPIO_PIN(PORT_C, 0), 2, 1}, /*< ADC123_IN_1 */ \ };
}
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -191,17 +191,17 @@ static const i2c_conf_t i2c_config[] = {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_C, 0), 10 }, \ { GPIO_PIN(PORT_C, 0), 10 },
{ GPIO_PIN(PORT_C, 1), 11 }, \ { GPIO_PIN(PORT_C, 1), 11 },
{ GPIO_PIN(PORT_C, 2), 12 }, \ { GPIO_PIN(PORT_C, 2), 12 },
/* ADC Temperature channel */ \ /* ADC Temperature channel */
{ GPIO_UNDEF, 16 }, \ { GPIO_UNDEF, 16 },
/* ADC VREF channel */ \ /* ADC VREF channel */
{ GPIO_UNDEF, 17 }, \ { GPIO_UNDEF, 17 },
} };
#define ADC_NUMOF (5) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
/** /**

View File

@ -58,16 +58,16 @@ extern "C" {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_C, 0), 0, 10 }, \ { GPIO_PIN(PORT_C, 0), 0, 10 },
{ GPIO_PIN(PORT_C, 1), 0, 11 }, \ { GPIO_PIN(PORT_C, 1), 0, 11 },
{ GPIO_PIN(PORT_C, 2), 0, 12 }, \ { GPIO_PIN(PORT_C, 2), 0, 12 },
{ GPIO_PIN(PORT_C, 3), 0, 13 }, \ { GPIO_PIN(PORT_C, 3), 0, 13 },
{ GPIO_PIN(PORT_C, 4), 0, 14 }, \ { GPIO_PIN(PORT_C, 4), 0, 14 },
{ GPIO_PIN(PORT_C, 5), 0, 15 } \ { GPIO_PIN(PORT_C, 5), 0, 15 }
} };
#define ADC_NUMOF (6) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
/** /**

View File

@ -152,16 +152,16 @@ static const spi_conf_t spi_config[] = {
* @name ADC configuration * @name ADC configuration
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_A, 0), 0 }, \ { GPIO_PIN(PORT_A, 0), 0 },
{ GPIO_PIN(PORT_A, 1), 1 }, \ { GPIO_PIN(PORT_A, 1), 1 },
{ GPIO_PIN(PORT_A, 2), 2 }, \ { GPIO_PIN(PORT_A, 2), 2 },
{ GPIO_PIN(PORT_A, 3), 3 }, \ { GPIO_PIN(PORT_A, 3), 3 },
{ GPIO_PIN(PORT_A, 4), 4 },\ { GPIO_PIN(PORT_A, 4), 4 },
{ GPIO_PIN(PORT_A, 5), 5 } \ { GPIO_PIN(PORT_A, 5), 5 }
} };
#define ADC_NUMOF (6) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -112,16 +112,16 @@ static const uart_conf_t uart_config[] = {
* [ pin, channel ] * [ pin, channel ]
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{ GPIO_PIN(PORT_C, 0), 10 },\ { GPIO_PIN(PORT_C, 0), 10 },
{ GPIO_PIN(PORT_C, 1), 11 },\ { GPIO_PIN(PORT_C, 1), 11 },
{ GPIO_PIN(PORT_C, 2), 12 },\ { GPIO_PIN(PORT_C, 2), 12 },
{ GPIO_PIN(PORT_C, 3), 13 },\ { GPIO_PIN(PORT_C, 3), 13 },
{ GPIO_PIN(PORT_C, 4), 14 },\ { GPIO_PIN(PORT_C, 4), 14 },
{ GPIO_PIN(PORT_C, 5), 15 } \ { GPIO_PIN(PORT_C, 5), 15 }
} };
#define ADC_NUMOF (6) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
/** /**

View File

@ -122,14 +122,14 @@ static const uart_conf_t uart_config[] = {
* PIN, device (ADCx), channel * PIN, device (ADCx), channel
* @{ * @{
*/ */
#define ADC_CONFIG { \ static const adc_conf_t adc_config[] = {
{GPIO_PIN(PORT_A, 1), 0, 1}, \ {GPIO_PIN(PORT_A, 1), 0, 1},
{GPIO_PIN(PORT_A, 4), 0, 4}, \ {GPIO_PIN(PORT_A, 4), 0, 4},
{GPIO_PIN(PORT_C, 1), 1, 11}, \ {GPIO_PIN(PORT_C, 1), 1, 11},
{GPIO_PIN(PORT_C, 2), 1, 12} \ {GPIO_PIN(PORT_C, 2), 1, 12}
} };
#define ADC_NUMOF (4) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
/** /**

View File

@ -243,15 +243,16 @@ static const i2c_conf_t i2c_config[] = {
* *
* @{ * @{
*/ */
#define ADC_NUMOF (6U) static const adc_conf_t adc_config[] = {
#define ADC_CONFIG { \ {GPIO_PIN(PORT_A, 3), 0, 3},
{GPIO_PIN(PORT_A, 3), 0, 3}, \ {GPIO_PIN(PORT_C, 0), 0, 10},
{GPIO_PIN(PORT_C, 0), 0, 10}, \ {GPIO_PIN(PORT_C, 3), 0, 4},
{GPIO_PIN(PORT_C, 3), 0, 4}, \ {GPIO_PIN(PORT_A, 4), 0, 14},
{GPIO_PIN(PORT_A, 4), 0, 14}, \ {GPIO_PIN(PORT_B, 7), 0, 7},
{GPIO_PIN(PORT_B, 7), 0, 7}, \ {GPIO_PIN(PORT_B, 6), 0, 6},
{GPIO_PIN(PORT_B, 6), 0, 6}, \ };
}
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -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 { \ #define ADC_NUMOF ARRAY_SIZE(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)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -83,8 +83,9 @@ static const i2c_conf_t i2c_config[] = {
* The configuration consists simply of a list of channels that should be used * The configuration consists simply of a list of channels that should be used
* @{ * @{
*/ */
#define ADC_CONFIG {4, 5, 6, 7} static const adc_conf_t adc_config[] = {4, 5, 6, 7};
#define ADC_NUMOF (4)
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -83,6 +83,11 @@ typedef enum {
/** @} */ /** @} */
#endif /* ndef DOXYGEN */ #endif /* ndef DOXYGEN */
/**
* @brief ADC configuration wrapper
*/
typedef gpio_t adc_conf_t;
/** /**
* @brief I2C (TWI) configuration options * @brief I2C (TWI) configuration options
*/ */

View File

@ -23,11 +23,6 @@
#include "periph/adc.h" #include "periph/adc.h"
#include "periph_conf.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 * @brief Lock to prevent concurrency issues when used from different threads
*/ */

View File

@ -23,11 +23,6 @@
#include "mutex.h" #include "mutex.h"
#include "periph/adc.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 * @brief Allocate locks for all three available ADC device
* *

View File

@ -30,11 +30,6 @@
*/ */
#define MAX_ADC_SPEED (14000000U) #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 * @brief Allocate locks for all three available ADC devices
*/ */

View File

@ -30,16 +30,6 @@
*/ */
#define MAX_ADC_SPEED (12000000U) #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 * @brief Allocate locks for all three available ADC devices
*/ */

View File

@ -29,11 +29,6 @@
*/ */
#define MAX_ADC_SPEED (12000000U) #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 * @brief Allocate locks for all three available ADC devices
*/ */

View File

@ -23,11 +23,6 @@
#include "mutex.h" #include "mutex.h"
#include "periph/adc.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 * @brief Allocate locks for all three available ADC device
* *

View File

@ -47,11 +47,6 @@
#define ADC_SAMPLE_TIME_192C (6) #define ADC_SAMPLE_TIME_192C (6)
#define ADC_SAMPLE_TIME_384C (7) #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 * @brief Allocate locks for all three available ADC device
* *

View File

@ -55,11 +55,6 @@
#define ADC_SMPR2_FIRST_CHAN (10) #define ADC_SMPR2_FIRST_CHAN (10)
#endif #endif
/**
* @brief Load the ADC configuration
*/
static const adc_conf_t adc_config[] = ADC_CONFIG;
/** /**
* @brief Allocate locks for all three available ADC devices * @brief Allocate locks for all three available ADC devices
*/ */