From 6e967f97769addbffa80793dac46310f6d202b28 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Thu, 13 Jul 2017 19:00:13 +0200 Subject: [PATCH] boards/kinetis-based: beautify ADC configuration --- boards/frdm-k64f/include/periph_conf.h | 15 +++--- boards/mulle/include/periph_conf.h | 54 ++++++++++++++-------- boards/pba-d-01-kw2x/include/periph_conf.h | 15 +++--- 3 files changed, 49 insertions(+), 35 deletions(-) diff --git a/boards/frdm-k64f/include/periph_conf.h b/boards/frdm-k64f/include/periph_conf.h index d15411571c..297a7ef388 100644 --- a/boards/frdm-k64f/include/periph_conf.h +++ b/boards/frdm-k64f/include/periph_conf.h @@ -99,17 +99,16 @@ static const uart_conf_t uart_config[] = { /** @} */ /** - * @name ADC configuration + * @name ADC configuration * @{ */ static const adc_conf_t adc_config[] = { - /* dev, pin, channel */ - { ADC0, GPIO_PIN(PORT_B, 10), 14 }, - { ADC0, GPIO_PIN(PORT_B, 11), 15 }, - { ADC0, GPIO_PIN(PORT_C, 11), 7 }, - { ADC0, GPIO_PIN(PORT_C, 10), 6 }, - { ADC0, GPIO_PIN(PORT_C, 8), 4 }, - { ADC0, GPIO_PIN(PORT_C, 9), 5 }, + { .dev = ADC0, .pin = GPIO_PIN(PORT_B, 10), .chan = 14 }, + { .dev = ADC0, .pin = GPIO_PIN(PORT_B, 11), .chan = 15 }, + { .dev = ADC0, .pin = GPIO_PIN(PORT_C, 11), .chan = 7 }, + { .dev = ADC0, .pin = GPIO_PIN(PORT_C, 10), .chan = 6 }, + { .dev = ADC0, .pin = GPIO_PIN(PORT_C, 8), .chan = 4 }, + { .dev = ADC0, .pin = GPIO_PIN(PORT_C, 9), .chan = 5 } }; #define ADC_NUMOF (sizeof(adc_config) / sizeof(adc_config[0])) diff --git a/boards/mulle/include/periph_conf.h b/boards/mulle/include/periph_conf.h index b01478f794..3a7aeb4f09 100644 --- a/boards/mulle/include/periph_conf.h +++ b/boards/mulle/include/periph_conf.h @@ -128,28 +128,44 @@ static const uart_conf_t uart_config[] = { /** @} */ /** - * @name ADC configuration + * @name ADC configuration * @{ */ static const adc_conf_t adc_config[] = { - /* dev, pin, channel */ - [ 0] = { ADC1, GPIO_UNDEF, 26 }, /* internal: temperature sensor */ - [ 1] = { ADC1, GPIO_UNDEF, 27 }, /* internal: band gap */ - [ 2] = { ADC1, GPIO_UNDEF, 29 }, /* internal: V_REFSH */ - [ 3] = { ADC1, GPIO_UNDEF, 30 }, /* internal: V_REFSL */ - [ 4] = { ADC1, GPIO_UNDEF, 23 }, /* internal: DAC0 module output level */ - [ 5] = { ADC1, GPIO_UNDEF, 18 }, /* internal: VREF module output level */ - [ 6] = { ADC1, GPIO_UNDEF, 0 }, /* on board connection to Mulle Vbat/2 on PGA1_DP pin */ - [ 7] = { ADC1, GPIO_UNDEF, 19 }, /* on board connection to Mulle Vchr/2 on PGA1_DM pin */ - [ 8] = { ADC0, GPIO_UNDEF, 0 }, /* expansion port PGA0_DP pin */ - [ 9] = { ADC0, GPIO_UNDEF, 19 }, /* expansion port PGA0_DM pin */ - [10] = { ADC1, GPIO_PIN(PORT_A, 17), 17 }, /* expansion port PTA17 */ - [11] = { ADC1, GPIO_PIN(PORT_B, 0), 8 }, /* expansion port PTB0 */ - [12] = { ADC0, GPIO_PIN(PORT_C, 0), 14 }, /* expansion port PTC0 */ - [13] = { ADC1, GPIO_PIN(PORT_C, 8), 4 }, /* expansion port PTC8 */ - [14] = { ADC1, GPIO_PIN(PORT_C, 9), 5 }, /* expansion port PTC9 */ - [15] = { ADC1, GPIO_PIN(PORT_C, 10), 6 }, /* expansion port PTC10 */ - [16] = { ADC1, GPIO_PIN(PORT_C, 11), 7 }, /* expansion port PTC11 */ + /* internal: temperature sensor */ + [ 0] = { .dev = ADC1, .pin = GPIO_UNDEF, .chan = 26 }, + /* internal: band gap */ + [ 1] = { .dev = ADC1, .pin = GPIO_UNDEF, .chan = 27 }, + /* internal: V_REFSH */ + [ 2] = { .dev = ADC1, .pin = GPIO_UNDEF, .chan = 29 }, + /* internal: V_REFSL */ + [ 3] = { .dev = ADC1, .pin = GPIO_UNDEF, .chan = 30 }, + /* internal: DAC0 module output level */ + [ 4] = { .dev = ADC1, .pin = GPIO_UNDEF, .chan = 23 }, + /* internal: VREF module output level */ + [ 5] = { .dev = ADC1, .pin = GPIO_UNDEF, .chan = 18 }, + /* on board connection to Mulle Vbat/2 on PGA1_DP pin */ + [ 6] = { .dev = ADC1, .pin = GPIO_UNDEF, .chan = 0 }, + /* on board connection to Mulle Vchr/2 on PGA1_DM pin */ + [ 7] = { .dev = ADC1, .pin = GPIO_UNDEF, .chan = 19 }, + /* expansion port PGA0_DP pin */ + [ 8] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 0 }, + /* expansion port PGA0_DM pin */ + [ 9] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 19 }, + /* expansion port PTA17 */ + [10] = { .dev = ADC1, .pin = GPIO_PIN(PORT_A, 17), .chan = 17 }, + /* expansion port PTB0 */ + [11] = { .dev = ADC1, .pin = GPIO_PIN(PORT_B, 0), .chan = 8 }, + /* expansion port PTC0 */ + [12] = { .dev = ADC0, .pin = GPIO_PIN(PORT_C, 0), .chan = 14 }, + /* expansion port PTC8 */ + [13] = { .dev = ADC1, .pin = GPIO_PIN(PORT_C, 8), .chan = 4 }, + /* expansion port PTC9 */ + [14] = { .dev = ADC1, .pin = GPIO_PIN(PORT_C, 9), .chan = 5 }, + /* expansion port PTC10 */ + [15] = { .dev = ADC1, .pin = GPIO_PIN(PORT_C, 10), .chan = 6 }, + /* expansion port PTC11 */ + [16] = { .dev = ADC1, .pin = GPIO_PIN(PORT_C, 11), .chan = 7 } }; #define ADC_NUMOF (sizeof(adc_config) / sizeof(adc_config[0])) diff --git a/boards/pba-d-01-kw2x/include/periph_conf.h b/boards/pba-d-01-kw2x/include/periph_conf.h index d9b547e65e..403f0245c0 100644 --- a/boards/pba-d-01-kw2x/include/periph_conf.h +++ b/boards/pba-d-01-kw2x/include/periph_conf.h @@ -114,17 +114,16 @@ static const uart_conf_t uart_config[] = { /** @} */ /** - * @name ADC configuration + * @name ADC configuration * @{ */ static const adc_conf_t adc_config[] = { - /* dev, pin, channel */ - { ADC0, GPIO_PIN(PORT_E, 2), 1 }, - { ADC0, GPIO_PIN(PORT_E, 3), 1 }, - { ADC0, GPIO_PIN(PORT_D, 7), 22 }, - { ADC0, GPIO_PIN(PORT_D, 5), 6 }, - { ADC0, GPIO_PIN(PORT_E, 0), 10 }, - { ADC0, GPIO_PIN(PORT_E, 1), 11 }, + { .dev = ADC0, .pin = GPIO_PIN(PORT_E, 2), .chan = 1 }, + { .dev = ADC0, .pin = GPIO_PIN(PORT_E, 3), .chan = 1 }, + { .dev = ADC0, .pin = GPIO_PIN(PORT_D, 7), .chan = 22 }, + { .dev = ADC0, .pin = GPIO_PIN(PORT_D, 5), .chan = 6 }, + { .dev = ADC0, .pin = GPIO_PIN(PORT_E, 0), .chan = 10 }, + { .dev = ADC0, .pin = GPIO_PIN(PORT_E, 1), .chan = 11 } }; #define ADC_NUMOF (sizeof(adc_config) / sizeof(adc_config[0]))