Skip to content

boards: arduino: Giga Display Shield, touch points #91980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KurtE
Copy link
Contributor

@KurtE KurtE commented Jun 22, 2025

Currently the config option:
CONFIG_INPUT_GT911_MAX_TOUCH_POINTS

is not defined for the Giga display shield and defaults
to 1. The valid range is 1-5, I have done most of my
own testing using 3 with the ArduinoGiga-zephyr

I have a PR against the ArduinoCore-zephyr project which allows me to define a callback in the Arduino system:
arduino/ArduinoCore-zephyr#134 And a version of the Arduino touch library with some support, the fork/branch
https://github.com/KurtE/Arduino_GigaDisplayTouch/tree/zephyr

And an example sketch that does touch paint.
arduino/ArduinoCore-zephyr#92 (comment)

Note: my version of the Arduino touch library has no support for gestures

Currently the config option:
CONFIG_INPUT_GT911_MAX_TOUCH_POINTS

is not defined for the Giga display shield and defaults
to 1.   The valid range is 1-5, I have done most of my
own testing using 3 with the ArduinoGiga-zephyr

I have a PR against the ArduinoCore-zephyr project
which allows me to define a callback in the Arduino
system:
arduino/ArduinoCore-zephyr#134

And a version of the Arduino touch library with some
support, the fork/branch
https://github.com/KurtE/Arduino_GigaDisplayTouch/tree/zephyr

And an example sketch that does touch paint.
arduino/ArduinoCore-zephyr#92 (comment)

Note: my version of the Arduino touch library has no support
for gestures

Signed-off-by: Kurt Eckhardt <[email protected]>
@KurtE KurtE force-pushed the giga_display_touch_points branch from 01e06c9 to be05936 Compare June 22, 2025 00:43
Copy link

@KurtE
Copy link
Contributor Author

KurtE commented Jun 22, 2025

A couple of other things I should mention:

I have not tested this with LVGL, as I don't use LVGL, and I am testing it using the Arduino Code base (ArduinoCore-zephyr),
which does not have any variant that uses LVGL. @iabdalkader - have you done much here with display shield using LVGL on zephyr?

I started off testing some of this using extracts from the zephyr\samples\subsys\input\draw_touch_events
example, but found that this was not sufficient for multiple touch testing. In particular it's touch_event_callback:

static void touch_event_callback(struct input_event *evt, void *user_data)
{
	if (evt->code == INPUT_ABS_X) {
		touch_point.x = evt->value;
	}
	if (evt->code == INPUT_ABS_Y) {
		touch_point.y = evt->value;
	}
	if (evt->code == INPUT_BTN_TOUCH) {
		touch_point.pressed = evt->value;
	}
	if (evt->sync) {
		k_sem_give(&sync);
	}
}

Does not process the callback which tells you which touh point the X, Y are associated with.
To do this you need to process the INPUT_ABS_MT_SLOT evt->code

My callback in the Arduino_GigaDisplayTouch - mentioned in the first post here, does process this. Note there are some
potential interesting discussions one might have about should the input system, give the callbacks some additional
information about how many touch points there are? The only thing it currently does is to send off the sequence of
touch points one after another. For example if two fingers are pressing you might receive callbacks something like:
MT_SLOT 0, ABS_X, ABS_Y, BTN_TOUCH, MT_SLOT 1, ABS_X, ABS_Y, BTN_TOUCH
Note: I shorthanded the message names here. So in the above when the input controller loops through each of the possible touches, for the current number of touches it has detected, it will call the callback 4 times, and the above case it will:
execute: k_sem_give(&zephyr_touch_event_sync) twice. Will the code that processes this event get called in between, and
might it cause issues. So far it appears to be working fine with my updated code in the ArduinoCore-zephyr code in
loader to allow a callback to be set at run time. And my callback within Arduino_GigaDisplayTouch.

#89743

@KurtE KurtE marked this pull request as ready for review June 22, 2025 13:38
@github-actions github-actions bot added size: XS A PR changing only a single line of code area: Shields Shields (add-on boards) labels Jun 22, 2025
@JarmouniA JarmouniA added the area: Input Input Subsystem and Drivers label Jun 22, 2025
@JarmouniA JarmouniA requested review from fabiobaltieri and faxe1008 and removed request for fabiobaltieri and faxe1008 June 22, 2025 19:08
@JarmouniA JarmouniA removed the area: Input Input Subsystem and Drivers label Jun 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Shields Shields (add-on boards) size: XS A PR changing only a single line of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants