From 89ed720f068e80c0c3cbaf2f257c83aa2c975b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Bj=C3=B6rnsson?= Date: Sat, 8 Apr 2023 23:07:22 +0200 Subject: [PATCH] tests: drivers: adc: adc_api: Move compat atmel,sam0-adc to DT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move channel description to devicetree for atmel,sam0-adc compatible to make the test more readable. Signed-off-by: Benjamin Björnsson --- .../boards/adafruit_trinket_m0.overlay | 29 +++++++++++++++++++ .../adc_api/boards/arduino_mkrzero.overlay | 29 +++++++++++++++++++ .../boards/arduino_nano_33_iot.overlay | 29 +++++++++++++++++++ .../adc/adc_api/boards/arduino_zero.overlay | 29 +++++++++++++++++++ .../adc/adc_api/boards/atsamc21n_xpro.overlay | 29 +++++++++++++++++++ .../adc/adc_api/boards/atsamd21_xpro.overlay | 29 +++++++++++++++++++ .../adc/adc_api/boards/atsame54_xpro.overlay | 29 +++++++++++++++++++ .../adc/adc_api/boards/atsaml21_xpro.overlay | 29 +++++++++++++++++++ .../adc/adc_api/boards/atsamr21_xpro.overlay | 29 +++++++++++++++++++ .../adc/adc_api/boards/atsamr34_xpro.overlay | 29 +++++++++++++++++++ .../adc/adc_api/boards/serpente.overlay | 29 +++++++++++++++++++ .../adc/adc_api/boards/wio_terminal.overlay | 29 +++++++++++++++++++ tests/drivers/adc/adc_api/src/test_adc.c | 10 ------- 13 files changed, 348 insertions(+), 10 deletions(-) create mode 100644 tests/drivers/adc/adc_api/boards/adafruit_trinket_m0.overlay create mode 100644 tests/drivers/adc/adc_api/boards/arduino_mkrzero.overlay create mode 100644 tests/drivers/adc/adc_api/boards/arduino_nano_33_iot.overlay create mode 100644 tests/drivers/adc/adc_api/boards/arduino_zero.overlay create mode 100644 tests/drivers/adc/adc_api/boards/atsamc21n_xpro.overlay create mode 100644 tests/drivers/adc/adc_api/boards/atsamd21_xpro.overlay create mode 100644 tests/drivers/adc/adc_api/boards/atsame54_xpro.overlay create mode 100644 tests/drivers/adc/adc_api/boards/atsaml21_xpro.overlay create mode 100644 tests/drivers/adc/adc_api/boards/atsamr21_xpro.overlay create mode 100644 tests/drivers/adc/adc_api/boards/atsamr34_xpro.overlay create mode 100644 tests/drivers/adc/adc_api/boards/serpente.overlay create mode 100644 tests/drivers/adc/adc_api/boards/wio_terminal.overlay diff --git a/tests/drivers/adc/adc_api/boards/adafruit_trinket_m0.overlay b/tests/drivers/adc/adc_api/boards/adafruit_trinket_m0.overlay new file mode 100644 index 00000000000000..77d3fcb909ee07 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/adafruit_trinket_m0.overlay @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2023 Benjamin Björnsson + */ + +#include + +#define ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC_Val 0x1BU + +/ { + zephyr,user { + io-channels = <&adc 0>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,input-positive = ; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/arduino_mkrzero.overlay b/tests/drivers/adc/adc_api/boards/arduino_mkrzero.overlay new file mode 100644 index 00000000000000..77d3fcb909ee07 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/arduino_mkrzero.overlay @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2023 Benjamin Björnsson + */ + +#include + +#define ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC_Val 0x1BU + +/ { + zephyr,user { + io-channels = <&adc 0>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,input-positive = ; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/arduino_nano_33_iot.overlay b/tests/drivers/adc/adc_api/boards/arduino_nano_33_iot.overlay new file mode 100644 index 00000000000000..77d3fcb909ee07 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/arduino_nano_33_iot.overlay @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2023 Benjamin Björnsson + */ + +#include + +#define ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC_Val 0x1BU + +/ { + zephyr,user { + io-channels = <&adc 0>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,input-positive = ; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/arduino_zero.overlay b/tests/drivers/adc/adc_api/boards/arduino_zero.overlay new file mode 100644 index 00000000000000..77d3fcb909ee07 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/arduino_zero.overlay @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2023 Benjamin Björnsson + */ + +#include + +#define ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC_Val 0x1BU + +/ { + zephyr,user { + io-channels = <&adc 0>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,input-positive = ; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/atsamc21n_xpro.overlay b/tests/drivers/adc/adc_api/boards/atsamc21n_xpro.overlay new file mode 100644 index 00000000000000..4476e205118452 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/atsamc21n_xpro.overlay @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2023 Benjamin Björnsson + */ + +#include + +#define ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC_Val 0x1BU + +/ { + zephyr,user { + io-channels = <&adc0 0>; + }; +}; + +&adc0 { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,input-positive = ; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/atsamd21_xpro.overlay b/tests/drivers/adc/adc_api/boards/atsamd21_xpro.overlay new file mode 100644 index 00000000000000..77d3fcb909ee07 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/atsamd21_xpro.overlay @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2023 Benjamin Björnsson + */ + +#include + +#define ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC_Val 0x1BU + +/ { + zephyr,user { + io-channels = <&adc 0>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,input-positive = ; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/atsame54_xpro.overlay b/tests/drivers/adc/adc_api/boards/atsame54_xpro.overlay new file mode 100644 index 00000000000000..1eac9513a8f038 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/atsame54_xpro.overlay @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2023 Benjamin Björnsson + */ + +#include + +#define ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC_Val 0x1AU + +/ { + zephyr,user { + io-channels = <&adc0 0>; + }; +}; + +&adc0 { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,input-positive = ; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/atsaml21_xpro.overlay b/tests/drivers/adc/adc_api/boards/atsaml21_xpro.overlay new file mode 100644 index 00000000000000..77d3fcb909ee07 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/atsaml21_xpro.overlay @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2023 Benjamin Björnsson + */ + +#include + +#define ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC_Val 0x1BU + +/ { + zephyr,user { + io-channels = <&adc 0>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,input-positive = ; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/atsamr21_xpro.overlay b/tests/drivers/adc/adc_api/boards/atsamr21_xpro.overlay new file mode 100644 index 00000000000000..77d3fcb909ee07 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/atsamr21_xpro.overlay @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2023 Benjamin Björnsson + */ + +#include + +#define ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC_Val 0x1BU + +/ { + zephyr,user { + io-channels = <&adc 0>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,input-positive = ; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/atsamr34_xpro.overlay b/tests/drivers/adc/adc_api/boards/atsamr34_xpro.overlay new file mode 100644 index 00000000000000..77d3fcb909ee07 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/atsamr34_xpro.overlay @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2023 Benjamin Björnsson + */ + +#include + +#define ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC_Val 0x1BU + +/ { + zephyr,user { + io-channels = <&adc 0>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,input-positive = ; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/serpente.overlay b/tests/drivers/adc/adc_api/boards/serpente.overlay new file mode 100644 index 00000000000000..77d3fcb909ee07 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/serpente.overlay @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2023 Benjamin Björnsson + */ + +#include + +#define ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC_Val 0x1BU + +/ { + zephyr,user { + io-channels = <&adc 0>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,input-positive = ; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/wio_terminal.overlay b/tests/drivers/adc/adc_api/boards/wio_terminal.overlay new file mode 100644 index 00000000000000..1eac9513a8f038 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/wio_terminal.overlay @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2023 Benjamin Björnsson + */ + +#include + +#define ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC_Val 0x1AU + +/ { + zephyr,user { + io-channels = <&adc0 0>; + }; +}; + +&adc0 { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,input-positive = ; + }; +}; diff --git a/tests/drivers/adc/adc_api/src/test_adc.c b/tests/drivers/adc/adc_api/src/test_adc.c index 6023f422763b37..e65b34ef102d00 100644 --- a/tests/drivers/adc/adc_api/src/test_adc.c +++ b/tests/drivers/adc/adc_api/src/test_adc.c @@ -29,16 +29,6 @@ #define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT #define ADC_1ST_CHANNEL_ID 0 -#elif defined(CONFIG_SOC_FAMILY_SAM0) -#include -#define ADC_DEVICE_NODE DT_INST(0, atmel_sam0_adc) -#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 0 -#define ADC_1ST_CHANNEL_INPUT ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC_Val - #endif /* Invalid value that is not supposed to be written by the driver. It is used