From 70b6a17a96f58fa77ed45837e7097879280bea27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Bj=C3=B6rnsson?= Date: Sat, 8 Apr 2023 22:45:03 +0200 Subject: [PATCH] tests: drivers: adc: adc_api: Move compat telink,b91-adc to DT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move channel description to devicetree for telink,b91-adc compatible to make the test more readable. Signed-off-by: Benjamin Björnsson --- .../adc/adc_api/boards/tlsr9518adk80d.overlay | 26 +++++++++++++++++++ tests/drivers/adc/adc_api/src/test_adc.c | 10 ------- 2 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 tests/drivers/adc/adc_api/boards/tlsr9518adk80d.overlay diff --git a/tests/drivers/adc/adc_api/boards/tlsr9518adk80d.overlay b/tests/drivers/adc/adc_api/boards/tlsr9518adk80d.overlay new file mode 100644 index 00000000000000..9ba1c06c589aa5 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/tlsr9518adk80d.overlay @@ -0,0 +1,26 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2023 Benjamin Björnsson + */ + +/ { + zephyr,user { + io-channels = <&adc 0>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1_4"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,input-positive = <15>; + }; +}; diff --git a/tests/drivers/adc/adc_api/src/test_adc.c b/tests/drivers/adc/adc_api/src/test_adc.c index 0e0533b22c1a61..05bfb34d3a61c3 100644 --- a/tests/drivers/adc/adc_api/src/test_adc.c +++ b/tests/drivers/adc/adc_api/src/test_adc.c @@ -19,16 +19,6 @@ #define ADC_1ST_CHANNEL_ID 0 #define ADC_2ND_CHANNEL_ID 1 -#elif defined(CONFIG_BOARD_TLSR9518ADK80D) - -#define ADC_DEVICE_NODE DT_INST(0, telink_b91_adc) -#define ADC_RESOLUTION 12 -#define ADC_GAIN ADC_GAIN_1_4 -#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 0x0f - #elif defined(CONFIG_BOARD_GD32A503V_EVAL) #define ADC_DEVICE_NODE DT_INST(0, gd_gd32_adc)