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

frdm-kw41z: Clean up ADC configuration

Reorder ADC lines to put the external connections first in the list.
Remove VREFH, VREFL signals. Add single ended reading of ADC0_DP
This commit is contained in:
Joakim Nohlgård 2018-08-20 15:12:20 +02:00
parent 635ecf9f1d
commit 504db007db
2 changed files with 21 additions and 20 deletions

View File

@ -32,45 +32,40 @@ extern "C" {
static const saul_adc_params_t saul_adc_params[] =
{
{
.name = "coretemp",
.name = "ADC0_DP-DM",
.line = ADC_LINE(0),
.res = ADC_RES_16BIT,
},
{
.name = "corebandgap",
.name = "ADC0_DP",
.line = ADC_LINE(1),
.res = ADC_RES_16BIT,
},
{
.name = "corevrefh",
.name = "PTB2",
.line = ADC_LINE(2),
.res = ADC_RES_16BIT,
},
{
.name = "corevrefl",
.name = "PTB3",
.line = ADC_LINE(3),
.res = ADC_RES_16BIT,
},
{
.name = "dcdcvbat",
.name = "coretemp",
.line = ADC_LINE(4),
.res = ADC_RES_16BIT,
},
{
.name = "ADC0_DP-DM",
.name = "corebandgap",
.line = ADC_LINE(5),
.res = ADC_RES_16BIT,
},
{
.name = "ADC0_SE2",
.name = "dcdcvbat",
.line = ADC_LINE(6),
.res = ADC_RES_16BIT,
},
{
.name = "ADC0_SE3",
.line = ADC_LINE(7),
.res = ADC_RES_16BIT,
},
};
#ifdef __cplusplus

View File

@ -128,16 +128,22 @@ static const uart_conf_t uart_config[] = {
*/
static const adc_conf_t adc_config[] = {
/* dev, pin, channel */
[ 0] = { ADC0, GPIO_UNDEF, 26 }, /* internal: temperature sensor */
/* ADC0_DP-ADC0_DM differential reading (Arduino A5 - A0) */
[ 0] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 0 | ADC_SC1_DIFF_MASK },
/* ADC0_DP single ended reading (Arduino A5) */
[ 1] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 0 },
/* PTB2 (Arduino A2) */
[ 2] = { .dev = ADC0, .pin = GPIO_PIN(PORT_B, 2), .chan = 3 },
/* PTB3 (Arduino A3) */
[ 3] = { .dev = ADC0, .pin = GPIO_PIN(PORT_B, 3), .chan = 2 },
/* internal: temperature sensor */
[ 4] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 26 },
/* Note: the band gap buffer uses a bit of current and is turned off by default,
* Set PMC->REGSC |= PMC_REGSC_BGBE_MASK before reading or the input will be floating */
[ 1] = { ADC0, GPIO_UNDEF, 27 }, /* internal: band gap */
[ 2] = { ADC0, GPIO_UNDEF, 29 }, /* internal: V_REFH */
[ 3] = { ADC0, GPIO_UNDEF, 30 }, /* internal: V_REFL */
[ 4] = { ADC0, GPIO_UNDEF, 23 }, /* internal: DCDC divided battery level */
[ 5] = { ADC0, GPIO_UNDEF, 0 | ADC_SC1_DIFF_MASK }, /* ADC0_DP-ADC0_DM differential reading */
[ 6] = { ADC0, GPIO_PIN(PORT_B, 3), 2 }, /* ADC0_SE2 */
[ 7] = { ADC0, GPIO_PIN(PORT_B, 2), 3 }, /* ADC0_SE3 */
/* internal: band gap */
[ 5] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 27 },
/* internal: DCDC divided battery level */
[ 6] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 23 },
};
#define ADC_NUMOF (sizeof(adc_config) / sizeof(adc_config[0]))
/*