Skip to content

Commit

Permalink
tests: add an kbd_matrix test suite
Browse files Browse the repository at this point in the history
Add an initial test suite for the keyboard scanning input library.

Signed-off-by: Fabio Baltieri <[email protected]>
  • Loading branch information
fabiobaltieri committed Dec 21, 2023
1 parent 978b0bb commit 8c83185
Show file tree
Hide file tree
Showing 10 changed files with 506 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/drivers/input/kbd_matrix/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})

project(input_kbd_matrix)

target_include_directories(app PRIVATE ${ZEPHYR_BASE}/drivers/input)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
10 changes: 10 additions & 0 deletions tests/drivers/input/kbd_matrix/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2023 Google LLC
# SPDX-License-Identifier: Apache-2.0

config INPUT_KBD_MATRIX
default y

config INPUT_KBD_DRIVE_COLUMN_HOOK
default y

source "Kconfig.zephyr"
9 changes: 9 additions & 0 deletions tests/drivers/input/kbd_matrix/actual-key-mask.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright 2023 Google LLC
*
* SPDX-License-Identifier: Apache-2.0
*/

&test_kbd_scan {
actual-key-mask = <0x07 0x07 0x03>;
};
17 changes: 17 additions & 0 deletions tests/drivers/input/kbd_matrix/boards/native_sim.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2023 Google LLC
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
test_kbd_scan: test-kbd-scan {
compatible = "test-kbd-scan";
row-size = <3>;
col-size = <3>;
poll-period-ms = <5>;
debounce-down-ms = <40>;
debounce-up-ms = <80>;
poll-timeout-ms = <500>;
};
};
7 changes: 7 additions & 0 deletions tests/drivers/input/kbd_matrix/boards/native_sim_64.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright 2023 Google LLC
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "native_sim.overlay"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2023 Google LLC
# SPDX-License-Identifier: Apache-2.0

description: Keyboard scan test binding

compatible: "test-kbd-scan"

include: kbd-matrix-common.yaml
9 changes: 9 additions & 0 deletions tests/drivers/input/kbd_matrix/no-ghostkey-check.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright 2023 Google LLC
*
* SPDX-License-Identifier: Apache-2.0
*/

&test_kbd_scan {
no-ghostkey-check;
};
5 changes: 5 additions & 0 deletions tests/drivers/input/kbd_matrix/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_ZTEST=y
CONFIG_INPUT=y
CONFIG_INPUT_MODE_SYNCHRONOUS=y
Loading

0 comments on commit 8c83185

Please sign in to comment.