forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: input: add a gpio-kbd-matrix test suite
Add an initial test suite for the gpio-kbd-matrix driver. Signed-off-by: Fabio Baltieri <[email protected]>
- Loading branch information
1 parent
109c53d
commit 978b0bb
Showing
7 changed files
with
507 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_gpio_kbd_matrix) | ||
|
||
target_include_directories(app PRIVATE ${ZEPHYR_BASE}/drivers/input) | ||
|
||
FILE(GLOB app_sources src/*.c) | ||
target_sources(app PRIVATE ${app_sources}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright 2023 Google LLC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config INPUT_KBD_DRIVE_COLUMN_HOOK | ||
default y | ||
|
||
source "Kconfig.zephyr" |
49 changes: 49 additions & 0 deletions
49
tests/drivers/input/gpio_kbd_matrix/boards/native_sim.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
&gpio0 { | ||
ngpios = <12>; | ||
}; | ||
|
||
/ { | ||
kbd_matrix_interrupt: kbd-matrix-interrupt { | ||
compatible = "gpio-kbd-matrix"; | ||
row-gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>, | ||
<&gpio0 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; | ||
col-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>, | ||
<&gpio0 3 GPIO_ACTIVE_LOW>; | ||
debounce-down-ms = <80>; | ||
debounce-up-ms = <40>; | ||
poll-timeout-ms = <500>; | ||
}; | ||
|
||
kbd_matrix_poll: kbd-matrix-poll { | ||
compatible = "gpio-kbd-matrix"; | ||
row-gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>, | ||
<&gpio0 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; | ||
col-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>, | ||
<&gpio0 7 GPIO_ACTIVE_LOW>; | ||
debounce-down-ms = <40>; | ||
debounce-up-ms = <80>; | ||
poll-timeout-ms = <500>; | ||
idle-mode = "poll"; | ||
col-drive-inactive; | ||
}; | ||
|
||
kbd_matrix_scan: kbd-matrix-scan { | ||
compatible = "gpio-kbd-matrix"; | ||
/* pins out of sequence to test non direct read */ | ||
row-gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>, | ||
<&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; | ||
col-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>, | ||
<&gpio0 10 GPIO_ACTIVE_LOW>; | ||
debounce-down-ms = <80>; | ||
debounce-up-ms = <40>; | ||
poll-timeout-ms = <0>; | ||
col-drive-inactive; | ||
idle-mode = "scan"; | ||
}; | ||
}; |
7 changes: 7 additions & 0 deletions
7
tests/drivers/input/gpio_kbd_matrix/boards/native_sim_64.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
CONFIG_ZTEST=y | ||
CONFIG_GPIO=y | ||
CONFIG_INPUT=y | ||
CONFIG_INPUT_MODE_SYNCHRONOUS=y |
Oops, something went wrong.