Inject a touch event


I am wanting to use the interrupt of a touch screen interface instead of having LVGL constantly polling it to see if there are any touches that are occurring.

What MCU/Processor/Board and compiler are you using?


What LVGL version are you using?


What do you want to achieve?

Stop LVGL from polling the touch screen driver

What have you tried so far?

Nothing, in the process of collecting information to see if it can be done.

Did you ever get info on this? I would like to do the same as well.
I have an idea but not sure if it’s the right approach

The easiest way to go about doing it is going to be using the indev driver callback function.

Do you have a code example?

Hi @reso,

I took a quick look at the indev code… This may or may not work as I can’t test it right now…

I think if you register your indev drivers as usual but after they are registered call:

lv_timer_del( indev_drv.read_timer );

To stop LVGL from polling.

Then just have your input device interrupt handler trigger a call to:

lv_indev_read_timer_cb( NULL );

It should hopefully work for you…

cc @kdschlosser

Kind Regards,


I’m currently trying this as well, but it seems that the structure with lvgl 8.3.7 is different, as seen below… I keep getting an error.

Then I have another question:
How can I manually send touch coordinates to a widget (e.g., lv_arc) and not automatically via LVGL?


Hi @epikao ,

Your code is just structured slightly differently to my example(I have changed my original post for simplicity), for your code this should work:

lv_timer_del( indev_drv.read_timer );

To send touch coordinates, you would need to write the coordinates to the variables which are updated by your my_touchpad_read() function and then call lv_indev_read_timer_cb( NULL );

Kind Regards,


Ok, is it possible to send the touch coordinates directly to a lv_arc widget for example?

There is no mechanism to send coordinates directly to a widget that I am aware of this is best left to the internals of LVGL in my opinion, can you describe what you are trying to achieve?

The method described above would emulate a touch or a click on the screen where ever you would like then the internals of LVGL work out which widget the click has hit etc.

see follwing video link:

As long as you don’t release your finger from the touch, you can still control a widget even when your finger is no longer within the widget’s area.
This is actually undesired for me. How can this be deactivated?

Best point to change this is your indev read callback or value changed callback.

Hi @epikao ,

You should be able to clear the press lock flag:

lv_obj_clear_flag(your_slider, LV_OBJ_FLAG_PRESS_LOCK);

Hopefully that will work for you…

Kind Regards,