Skip to content

Commit b4ee9a2

Browse files
committed
driver: input: added input_tsc_keys
input_tsc_keys to detect key press releases using STM32 TSC Signed-off-by: Arif Balik <[email protected]>
1 parent ad33c82 commit b4ee9a2

File tree

6 files changed

+539
-0
lines changed

6 files changed

+539
-0
lines changed

boards/st/stm32u083c_dk/stm32u083c_dk.dts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,11 @@
146146
group = <6>;
147147
channel-ios = <TSC_IO2>;
148148
sampling-io = <TSC_IO1>;
149+
ts1 {
150+
compatible = "tsc-keys";
151+
sampling-interval-ms = <10>;
152+
noise-threshold = <50>;
153+
zephyr,code = <INPUT_KEY_0>;
154+
};
149155
};
150156
};

drivers/input/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ zephyr_library_sources_ifdef(CONFIG_INPUT_PAW32XX input_paw32xx.c)
2828
zephyr_library_sources_ifdef(CONFIG_INPUT_PINNACLE input_pinnacle.c)
2929
zephyr_library_sources_ifdef(CONFIG_INPUT_PMW3610 input_pmw3610.c)
3030
zephyr_library_sources_ifdef(CONFIG_INPUT_SBUS input_sbus.c)
31+
zephyr_library_sources_ifdef(CONFIG_INPUT_STM32_TSC_KEYS input_tsc_keys.c)
3132
zephyr_library_sources_ifdef(CONFIG_INPUT_STMPE811 input_stmpe811.c)
3233
zephyr_library_sources_ifdef(CONFIG_INPUT_TOUCH input_touch.c)
3334
zephyr_library_sources_ifdef(CONFIG_INPUT_XEC_KBD input_xec_kbd.c)

drivers/input/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ source "drivers/input/Kconfig.sbus"
3333
source "drivers/input/Kconfig.sdl"
3434
source "drivers/input/Kconfig.stmpe811"
3535
source "drivers/input/Kconfig.touch"
36+
source "drivers/input/Kconfig.tsc_keys"
3637
source "drivers/input/Kconfig.xec"
3738
source "drivers/input/Kconfig.xpt2046"
3839
# zephyr-keep-sorted-stop

drivers/input/Kconfig.tsc_keys

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2024 Arif Balik <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config INPUT_STM32_TSC_KEYS
5+
bool "STM32 TSC touch library"
6+
default y
7+
depends on DT_HAS_ST_STM32_TSC_ENABLED
8+
select RING_BUFFER
9+
help
10+
Enable support for STM32 TSC touch library.
11+
12+
config INPUT_STM32_TSC_KEYS_BUFFER_WORD_SIZE
13+
int "STM32 TSC touch buffer size in words"
14+
default 10
15+
depends on INPUT_STM32_TSC_KEYS
16+
help
17+
Size of the ring buffer for the STM32 TSC touch library. The size of this
18+
buffer together with the sampling-interval property in the tsc-keys
19+
device tree node determines the time window of interest. A slope value is
20+
calculated between the oldest and the newest value in the buffer to
21+
generate a press or release input event.

0 commit comments

Comments
 (0)