Commit 8941a210 authored by Dominik Lau's avatar Dominik Lau Committed by Fabio Baltieri
Browse files

samples: drivers: added a simple touch controller sample

The sample is supposed to help examine the issues with touchscreen.
It draws a plus in last touched position.

Signed-off-by: default avatarDominik Lau <dlau@internships.antmicro.com>
Signed-off-by: default avatarFilip Kokosinski <fkokosinski@antmicro.com>
parent ac670c45
Loading
Loading
Loading
Loading
+1 −0
Changes for boards/native/native_sim/native_sim.dts: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
		zephyr,canbus = &can_loopback0;
		zephyr,code-partition = &slot0_partition;
		zephyr,bt-hci = &bt_hci_userchan;
		zephyr,touch = &input_sdl_touch;
	};

	aliases {
+7 −0
Changes for samples/subsys/input/draw_touch_events/CMakeLists.txt: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
# SPDX-License-Identifier: Apache-2.0

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

target_sources(app PRIVATE src/main.c)
+8 −0
Changes for samples/subsys/input/draw_touch_events/Kconfig: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Copyright (c) 2024 Antmicro <www.antmicro.com>
# SPDX-License-Identifier: Apache-2.0

config SCREEN_WIDTH_TO_CROSS_DIM
	int "Screen width to cross horizontal/vertical dimension ratio"
	default 25

source "Kconfig.zephyr"
+32 −0
Changes for samples/subsys/input/draw_touch_events/README.rst: 32 added lines, 0 removed lines.
Original line number Diff line number Diff line
.. zephyr:code-sample:: draw_touch_events
   :name: Draw touch events
   :relevant-api: input_events display_interface

   Visualize touch events on a display.

Overview
********
This sample will draw a small plus in the last touched coordinates, that way you can check
if the touch screen works for a board, examine its parameters such as inverted/swapped axes.

Building and Running
********************
While this is a generic sample and it should work with any boards with both display controllers
and touch controllers supported by Zephyr (provided the corresponding ``/chosen node`` properties
are set i.e. ``zephyr,touch`` and ``zephyr,display``).
Below is an example on how to build the sample for :ref:`stm32f746g_disco_board`:

.. zephyr-app-commands::
   :zephyr-app: samples/subsys/input/draw_touch_events
   :board: stm32f746g_disco
   :goals: build
   :compact:

For testing purposes without the need of any hardware, the :ref:`native_sim <native_sim>`
board is also supported and can be built as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/subsys/input/draw_touch_events
   :board: native_sim
   :goals: build
   :compact:
+4 −0
Changes for samples/subsys/input/draw_touch_events/prj.conf: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_LOG=y
CONFIG_INPUT=y
CONFIG_DISPLAY=y
Loading