Skip to content
Snippets Groups Projects
Unverified Commit 185c5a53 authored by Francisco Acosta's avatar Francisco Acosta Committed by GitHub
Browse files

Merge pull request #9801 from gebart/pr/frdm-kw41z-adc-config

frdm-kw41z: Clean up ADC configuration
parents bee9a210 504db007
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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]))
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment