Skip to content
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

Q: please add simple touch example #4

Open
SpaceTeddy opened this issue Jul 21, 2023 · 1 comment
Open

Q: please add simple touch example #4

SpaceTeddy opened this issue Jul 21, 2023 · 1 comment

Comments

@SpaceTeddy
Copy link

Dear all,
the support library works nice and I had less problems to get the T-RGB running with my own lvgl screens.
Touch is new for me and to be honest, I'm not able to find out how the touch event handling works.
Could you please add a simple example with just one lv_label which includes the x/y coordinates and changing label colours if the label is pressed or released?

would be great,

thx
Chris

@euphi
Copy link
Member

euphi commented Sep 17, 2023

The TRGBArduinoSupport library automatically sets up lvgl to use touch.
The released version 0.4 supports the FT3267 touch controller only, which is used in the oval/half-circle variant of T-RGB.
The round version uses a CST820 touch controller. This is supported by the TRGBArduinoSupport library since today (see latest commit), but not yet released. So if you want to give it a try, use the git version in platformio.ini.

The touch driver is initialized in line 149ff of TRGBSupport.cpp:

	lv_indev_drv_init(&indev_drv);
	indev_drv.type = LV_INDEV_TYPE_POINTER;
	indev_drv.read_cb = lv_touchpad_read;
	lv_indev_drv_register(&indev_drv);

The lv_touchpad_read is the callback function that lvgl calls whenever it wants to update the pointer position.
You can see it in line 28ff. of TRGBSupport.cpp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants