Skip to content

Commit 73c2240

Browse files
nordic-piksPerMac
authored andcommitted
samples: zephyr: subsys: usb: enable hid testing for H20 and L20
Based on zephyr. Signed-off-by: Piotr Kosycarz <[email protected]>
1 parent 50ae83e commit 73c2240

File tree

19 files changed

+283
-0
lines changed

19 files changed

+283
-0
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@
677677
/samples/zephyr/sensor/bme680/ @nrfconnect/ncs-low-level-test
678678
/samples/zephyr/sensor/qdec/ @nrfconnect/ncs-low-level-test
679679
/samples/zephyr/subsys/settings/ @nrfconnect/ncs-low-level-test
680+
/samples/zephyr/subsys/usb/ @nrfconnect/ncs-low-level-test
680681

681682
/samples/**/*.svg @nrfconnect/ncs-doc-leads
682683
/samples/**/*.png @nrfconnect/ncs-doc-leads
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
project(hid-keyboard)
11+
12+
include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake)
13+
FILE(GLOB app_sources ${ZEPHYR_BASE}/samples/subsys/usb/hid-keyboard/src/*.c)
14+
target_sources(app PRIVATE ${app_sources})
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
source "samples/subsys/usb/hid-keyboard/Kconfig"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This sample extends the same-named Zephyr sample to verify it
2+
with Nordic development kits.
3+
4+
Source code and basic configuration files can be found in the corresponding folder structure in zephyr/samples/subsys/usb/hid-keyboard.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/ {
2+
hid_dev_0: hid_dev_0 {
3+
compatible = "zephyr,hid-device";
4+
interface-name = "HID0";
5+
protocol-code = "keyboard";
6+
in-report-size = <64>;
7+
in-polling-period-us = <1000>;
8+
};
9+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/ {
2+
hid_dev_0: hid_dev_0 {
3+
compatible = "zephyr,hid-device";
4+
interface-name = "HID0";
5+
in-report-size = <256>;
6+
in-polling-period-us = <1000>;
7+
};
8+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "large_in_report.overlay"
2+
3+
/ {
4+
hid_dev_0: hid_dev_0 {
5+
compatible = "zephyr,hid-device";
6+
out-report-size = <128>;
7+
out-polling-period-us = <16000>;
8+
};
9+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "app.overlay"
2+
3+
/ {
4+
hid_dev_0: hid_dev_0 {
5+
compatible = "zephyr,hid-device";
6+
out-report-size = <64>;
7+
out-polling-period-us = <16000>;
8+
};
9+
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CONFIG_USB_DEVICE_STACK_NEXT=y
2+
CONFIG_USBD_HID_SUPPORT=y
3+
4+
CONFIG_LOG=y
5+
CONFIG_USBD_LOG_LEVEL_INF=y
6+
CONFIG_USBD_HID_LOG_LEVEL_WRN=y
7+
CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y
8+
CONFIG_LOG_BUFFER_SIZE=8192
9+
10+
CONFIG_SAMPLE_USBD_PID=0x0007
11+
12+
CONFIG_GPIO=y
13+
CONFIG_INPUT=y
14+
CONFIG_INPUT_MODE_SYNCHRONOUS=y
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
sample:
2+
name: USB HID keyboard sample
3+
common:
4+
filter: dt_alias_exists("sw0") and dt_alias_exists("led0")
5+
depends_on:
6+
# - usbd
7+
- gpio
8+
tags:
9+
- usb
10+
- ci_samples_zephyr_subsys_usb
11+
timeout: 15
12+
harness: console
13+
harness_config:
14+
type: multi_line
15+
regex:
16+
- "HS bNumConfigurations 1"
17+
- "FS bNumConfigurations 1"
18+
- "HID keyboard sample is initialized"
19+
- "USBD message: VBUS ready"
20+
- "Actual device speed 2"
21+
- "s-in-status finished"
22+
tests:
23+
nrf.extended.sample.usbd.hid-keyboard:
24+
integration_platforms:
25+
- nrf54h20dk/nrf54h20/cpuapp
26+
platform_allow:
27+
- nrf54h20dk/nrf54h20/cpuapp
28+
nrf.extended.sample.usbd.hid-keyboard.out-report:
29+
integration_platforms:
30+
- nrf54h20dk/nrf54h20/cpuapp
31+
platform_allow:
32+
- nrf54h20dk/nrf54h20/cpuapp
33+
extra_args:
34+
- EXTRA_DTC_OVERLAY_FILE="out_report.overlay"
35+
nrf.extended.sample.usbd.hid-keyboard.large-report:
36+
integration_platforms:
37+
- nrf54h20dk/nrf54h20/cpuapp
38+
platform_allow:
39+
- nrf54h20dk/nrf54h20/cpuapp
40+
extra_args:
41+
- EXTRA_DTC_OVERLAY_FILE="large_in_report.overlay"
42+
nrf.extended.sample.usbd.hid-keyboard.large-out-report:
43+
integration_platforms:
44+
- nrf54h20dk/nrf54h20/cpuapp
45+
platform_allow:
46+
- nrf54h20dk/nrf54h20/cpuapp
47+
extra_args:
48+
- EXTRA_DTC_OVERLAY_FILE="large_out_report.overlay"
49+
nrf.extended.sample.usbd.hid-keyboard.l20:
50+
integration_platforms:
51+
- nrf54l20pdk/nrf54l20/cpuapp
52+
platform_allow:
53+
- nrf54l20pdk/nrf54l20/cpuapp
54+
harness_config:
55+
type: multi_line
56+
regex:
57+
- "HS bNumConfigurations 1"
58+
- "FS bNumConfigurations 1"
59+
- "HID keyboard sample is initialized"
60+
nrf.extended.sample.usbd.hid-keyboard.out-report.l20:
61+
integration_platforms:
62+
- nrf54l20pdk/nrf54l20/cpuapp
63+
platform_allow:
64+
- nrf54l20pdk/nrf54l20/cpuapp
65+
extra_args:
66+
- EXTRA_DTC_OVERLAY_FILE="out_report.overlay"
67+
harness_config:
68+
type: multi_line
69+
regex:
70+
- "HS bNumConfigurations 1"
71+
- "FS bNumConfigurations 1"
72+
- "HID keyboard sample is initialized"
73+
nrf.extended.sample.usbd.hid-keyboard.large-report.l20:
74+
integration_platforms:
75+
- nrf54l20pdk/nrf54l20/cpuapp
76+
platform_allow:
77+
- nrf54l20pdk/nrf54l20/cpuapp
78+
extra_args:
79+
- EXTRA_DTC_OVERLAY_FILE="large_in_report.overlay"
80+
harness_config:
81+
type: multi_line
82+
regex:
83+
- "HS bNumConfigurations 1"
84+
- "FS bNumConfigurations 1"
85+
- "HID keyboard sample is initialized"
86+
nrf.extended.sample.usbd.hid-keyboard.large-out-report.l20:
87+
integration_platforms:
88+
- nrf54l20pdk/nrf54l20/cpuapp
89+
platform_allow:
90+
- nrf54l20pdk/nrf54l20/cpuapp
91+
extra_args:
92+
- EXTRA_DTC_OVERLAY_FILE="large_out_report.overlay"
93+
harness_config:
94+
type: multi_line
95+
regex:
96+
- "HS bNumConfigurations 1"
97+
- "FS bNumConfigurations 1"
98+
- "HID keyboard sample is initialized"

0 commit comments

Comments
 (0)