Hello,
I am using nrf5340dk board to test KSCAN sample.I add overlay file in my kscan application and modify code below:
Fullscreen
1
2
//const struct device *const kscan_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_keyboard_scan));
const struct device *const kscan_dev = DEVICE_DT_GET(DT_NODELABEL(kscan0));
Here is my overlay file "nrf5340dk_nrf5340_cpuapp.overlay":
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/ {
chosen {
kscan = &kscan0;
};
kscan0: kscan_0 {
compatible = "kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
col-gpios
= <&gpio1 4 GPIO_ACTIVE_HIGH>
, <&gpio1 5 GPIO_ACTIVE_HIGH>
, <&gpio1 6 GPIO_ACTIVE_HIGH>
;
row-gpios
= <&gpio0 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
When building,it occurs error:
Fullscreen
1
2
3
4
5
6
7
c:/nordic/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: app/libapp.a(main.c.obj): in function `block_matrix_callback':
C:\NORDIC\nrf5340_test_1212\kscan\src\main.c:153: undefined reference to `__device_dts_ord_10'
c:/nordic/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: app/libapp.a(main.c.obj): in function `main':
C:\NORDIC\nrf5340_test_1212\kscan\src\main.c:169: undefined reference to `__device_dts_ord_10'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'c:\NORDIC\toolchains\v2.2.0\opt\bin\cmake.EXE' --build 'c:\NORDIC\nrf5340_test_1212\kscan\build'
It seems that there is something wrong with "DEVICE_DT_GET(DT_NODELABEL(kscan0))".
I checked my zephyr.dts,kscan0 is declared in it.
Is there anything else that needs to be modified?
The nRF connect SDK version I used is v2.2.0.