Skip to content

Commit

Permalink
tests: drivers: adc: adc_api: Move compat nxp,kinetis-adc16 to DT
Browse files Browse the repository at this point in the history
Move channel description to devicetree for nxp,kinetis-adc16
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <[email protected]>
  • Loading branch information
benjaminbjornsson authored and carlescufi committed Apr 14, 2023
1 parent 34dad8c commit c3c9ce5
Show file tree
Hide file tree
Showing 8 changed files with 190 additions and 73 deletions.
28 changes: 28 additions & 0 deletions tests/drivers/adc/adc_api/boards/frdm_k22f.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023 Benjamin Björnsson <[email protected]>
*/

#include <zephyr/dt-bindings/adc/adc.h>

/ {
zephyr,user {
io-channels = <&adc0 14>;
};
};

&adc0 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

channel@e {
reg = <14>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <0>;
zephyr,resolution = <12>;
};
};
27 changes: 27 additions & 0 deletions tests/drivers/adc/adc_api/boards/frdm_k64f.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023 Benjamin Björnsson <[email protected]>
*/

#include <zephyr/dt-bindings/adc/adc.h>

/ {
zephyr,user {
io-channels = <&adc0 14>;
};
};

&adc0 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

channel@e {
reg = <14>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};
27 changes: 27 additions & 0 deletions tests/drivers/adc/adc_api/boards/frdm_k82f.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023 Benjamin Björnsson <[email protected]>
*/

#include <zephyr/dt-bindings/adc/adc.h>

/ {
zephyr,user {
io-channels = <&adc0 15>;
};
};

&adc0 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

channel@f {
reg = <15>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};
27 changes: 27 additions & 0 deletions tests/drivers/adc/adc_api/boards/frdm_kl25z.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023 Benjamin Björnsson <[email protected]>
*/

#include <zephyr/dt-bindings/adc/adc.h>

/ {
zephyr,user {
io-channels = <&adc0 12>;
};
};

&adc0 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

channel@c {
reg = <12>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};
27 changes: 27 additions & 0 deletions tests/drivers/adc/adc_api/boards/frdm_kw41z.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023 Benjamin Björnsson <[email protected]>
*/

#include <zephyr/dt-bindings/adc/adc.h>

/ {
zephyr,user {
io-channels = <&adc0 3>;
};
};

&adc0 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

channel@3 {
reg = <3>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};
27 changes: 27 additions & 0 deletions tests/drivers/adc/adc_api/boards/hexiwear_k64.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023 Benjamin Björnsson <[email protected]>
*/

#include <zephyr/dt-bindings/adc/adc.h>

/ {
zephyr,user {
io-channels = <&adc0 16>;
};
};

&adc0 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

channel@10 {
reg = <16>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};
27 changes: 27 additions & 0 deletions tests/drivers/adc/adc_api/boards/hexiwear_kw40z.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023 Benjamin Björnsson <[email protected]>
*/

#include <zephyr/dt-bindings/adc/adc.h>

/ {
zephyr,user {
io-channels = <&adc0 1>;
};
};

&adc0 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};
73 changes: 0 additions & 73 deletions tests/drivers/adc/adc_api/src/test_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,6 @@
#define ADC_1ST_CHANNEL_ID 0
#define ADC_2ND_CHANNEL_ID 1

#elif defined(CONFIG_BOARD_FRDM_K22F)

#define ADC_DEVICE_NODE DT_INST(0, nxp_kinetis_adc16)
#define ADC_RESOLUTION 12
#define ADC_GAIN ADC_GAIN_1
#define ADC_REFERENCE ADC_REF_INTERNAL
#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
#define ADC_1ST_CHANNEL_ID 14
#define ADC_1ST_CHANNEL_INPUT 0

#elif defined(CONFIG_BOARD_FRDM_K64F)

#define ADC_DEVICE_NODE DT_INST(0, nxp_kinetis_adc16)
#define ADC_RESOLUTION 12
#define ADC_GAIN ADC_GAIN_1
#define ADC_REFERENCE ADC_REF_INTERNAL
#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
#define ADC_1ST_CHANNEL_ID 14

#elif defined(CONFIG_BOARD_TLSR9518ADK80D)

#define ADC_DEVICE_NODE DT_INST(0, telink_b91_adc)
Expand All @@ -48,33 +29,6 @@
#define ADC_1ST_CHANNEL_ID 0
#define ADC_1ST_CHANNEL_INPUT 0x0f

#elif defined(CONFIG_BOARD_FRDM_K82F)

#define ADC_DEVICE_NODE DT_INST(0, nxp_kinetis_adc16)
#define ADC_RESOLUTION 12
#define ADC_GAIN ADC_GAIN_1
#define ADC_REFERENCE ADC_REF_INTERNAL
#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
#define ADC_1ST_CHANNEL_ID 15

#elif defined(CONFIG_BOARD_FRDM_KL25Z)

#define ADC_DEVICE_NODE DT_INST(0, nxp_kinetis_adc16)
#define ADC_RESOLUTION 12
#define ADC_GAIN ADC_GAIN_1
#define ADC_REFERENCE ADC_REF_INTERNAL
#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
#define ADC_1ST_CHANNEL_ID 12

#elif defined(CONFIG_BOARD_FRDM_KW41Z)

#define ADC_DEVICE_NODE DT_INST(0, nxp_kinetis_adc16)
#define ADC_RESOLUTION 12
#define ADC_GAIN ADC_GAIN_1
#define ADC_REFERENCE ADC_REF_INTERNAL
#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
#define ADC_1ST_CHANNEL_ID 3

#elif defined(CONFIG_BOARD_GD32A503V_EVAL)

#define ADC_DEVICE_NODE DT_INST(0, gd_gd32_adc)
Expand All @@ -84,33 +38,6 @@
#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
#define ADC_1ST_CHANNEL_ID 1

#elif defined(CONFIG_BOARD_HEXIWEAR_K64)

#define ADC_DEVICE_NODE DT_INST(0, nxp_kinetis_adc16)
#define ADC_RESOLUTION 12
#define ADC_GAIN ADC_GAIN_1
#define ADC_REFERENCE ADC_REF_INTERNAL
#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
#define ADC_1ST_CHANNEL_ID 16

#elif defined(CONFIG_BOARD_FRDM_K82F)

#define ADC_DEVICE_NODE DT_INST(0, nxp_kinetis_adc16)
#define ADC_RESOLUTION 12
#define ADC_GAIN ADC_GAIN_1
#define ADC_REFERENCE ADC_REF_INTERNAL
#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
#define ADC_1ST_CHANNEL_ID 26

#elif defined(CONFIG_BOARD_HEXIWEAR_KW40Z)

#define ADC_DEVICE_NODE DT_INST(0, nxp_kinetis_adc16)
#define ADC_RESOLUTION 12
#define ADC_GAIN ADC_GAIN_1
#define ADC_REFERENCE ADC_REF_INTERNAL
#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
#define ADC_1ST_CHANNEL_ID 1

#elif defined(CONFIG_BOARD_SAM_E70_XPLAINED) || \
defined(CONFIG_BOARD_SAM_V71_XULT)

Expand Down

0 comments on commit c3c9ce5

Please sign in to comment.