Skip to content

Commit 214e080

Browse files
[nrf fromlist] tests: boards: nrf: comp: Move AIN index to Kconfig
Moved index of analog input used in test from source code to Kconfig option to simplify adding new targets. Upstream PR #: 89609 Signed-off-by: Michał Stasiak <[email protected]>
1 parent e1b4532 commit 214e080

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

tests/boards/nrf/comp/Kconfig

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) 2025 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config TEST_COMP_SE_PSEL_AIN_INDEX
5+
int "Index od analog input for SE psel."
6+
default 5
7+
8+
config TEST_COMP_SE_EXTREFSEL_AIN_INDEX
9+
int "Index od analog input for SE extrefsel."
10+
default 1
11+
12+
config TEST_COMP_DIFF_PSEL_AIN_INDEX
13+
int "Index od analog input for DIFF psel."
14+
default 4
15+
16+
config TEST_COMP_DIFF_EXTREFSEL_AIN_INDEX
17+
int "Index od analog input for DIFF extrefsel."
18+
default 5
19+
20+
source "Kconfig.zephyr"

tests/boards/nrf/comp/src/test.c

+12-4
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,30 @@ static const struct device *test_dev = DEVICE_DT_GET(DT_ALIAS(test_comp));
1313
static const struct gpio_dt_spec test_pin_1 = GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), first_gpios);
1414
static const struct gpio_dt_spec test_pin_2 = GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), second_gpios);
1515

16+
#define TEST_COMP_SE_PSEL_AIN _CONCAT(COMP_NRF_COMP_PSEL_AIN, \
17+
CONFIG_TEST_COMP_SE_PSEL_AIN_INDEX)
18+
#define TEST_COMP_SE_EXTREFSEL_AIN _CONCAT(COMP_NRF_COMP_EXTREFSEL_AIN, \
19+
CONFIG_TEST_COMP_SE_EXTREFSEL_AIN_INDEX)
20+
#define TEST_COMP_DIFF_PSEL_AIN _CONCAT(COMP_NRF_COMP_PSEL_AIN, \
21+
CONFIG_TEST_COMP_DIFF_PSEL_AIN_INDEX)
22+
#define TEST_COMP_DIFF_EXTREFSEL_AIN _CONCAT(COMP_NRF_COMP_EXTREFSEL_AIN, \
23+
CONFIG_TEST_COMP_DIFF_EXTREFSEL_AIN_INDEX)
1624

1725
struct comp_nrf_comp_se_config comp_se_config = {
18-
.psel = COMP_NRF_COMP_PSEL_AIN5,
26+
.psel = TEST_COMP_SE_PSEL_AIN,
1927
.sp_mode = COMP_NRF_COMP_SP_MODE_HIGH,
2028
.isource = COMP_NRF_COMP_ISOURCE_DISABLED,
2129
.refsel = COMP_NRF_COMP_REFSEL_AREF,
22-
.extrefsel = COMP_NRF_COMP_EXTREFSEL_AIN1,
30+
.extrefsel = TEST_COMP_SE_EXTREFSEL_AIN,
2331
.th_up = 32,
2432
.th_down = 32,
2533
};
2634

2735
struct comp_nrf_comp_diff_config comp_diff_config = {
28-
.psel = COMP_NRF_COMP_PSEL_AIN4,
36+
.psel = TEST_COMP_DIFF_PSEL_AIN,
2937
.sp_mode = COMP_NRF_COMP_SP_MODE_LOW,
3038
.isource = COMP_NRF_COMP_ISOURCE_DISABLED,
31-
.extrefsel = COMP_NRF_COMP_EXTREFSEL_AIN5,
39+
.extrefsel = TEST_COMP_DIFF_EXTREFSEL_AIN,
3240
.enable_hyst = true,
3341
};
3442

0 commit comments

Comments
 (0)