Skip to content

Commit

Permalink
tests: drivers: adc: adc_api: Move compat atmel,sam-adc to DT
Browse files Browse the repository at this point in the history
Move channel description to devicetree for atmel,sam-adc
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 b09423f commit 9024ffa
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
28 changes: 28 additions & 0 deletions tests/drivers/adc/adc_api/boards/sam4s_xplained.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 15>;
};
};

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

channel@f {
reg = <15>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_EXTERNAL0";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
zephyr,input-positive = <15>;
};
};
10 changes: 0 additions & 10 deletions tests/drivers/adc/adc_api/src/test_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@
#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
#define ADC_1ST_CHANNEL_ID 0

#elif defined(CONFIG_BOARD_SAM4S_XPLAINED)

#define ADC_DEVICE_NODE DT_INST(0, atmel_sam_adc)
#define ADC_RESOLUTION 12
#define ADC_GAIN ADC_GAIN_1
#define ADC_REFERENCE ADC_REF_EXTERNAL0
#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
#define ADC_1ST_CHANNEL_ID 15
#define ADC_1ST_CHANNEL_INPUT 15

#elif defined(CONFIG_SOC_FAMILY_SAM0)
#include <soc.h>
#define ADC_DEVICE_NODE DT_INST(0, atmel_sam0_adc)
Expand Down

0 comments on commit 9024ffa

Please sign in to comment.