Skip to content

Commit

Permalink
tests: drivers: adc: adc_api: Move compat gd,gd32-adc to DT
Browse files Browse the repository at this point in the history
Move channel description to devicetree for gd,gd32-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 70b6a17 commit b09423f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
27 changes: 27 additions & 0 deletions tests/drivers/adc/adc_api/boards/gd32a503v_eval.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 {
/* adjust channel number according to pinmux in board.dts */
io-channels = <&adc0 1>;
};
};

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

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

#elif defined(CONFIG_BOARD_GD32A503V_EVAL)

#define ADC_DEVICE_NODE DT_INST(0, gd_gd32_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 1

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

Expand Down

0 comments on commit b09423f

Please sign in to comment.