Skip to main content
sk-st
Associate III
March 19, 2024
Solved

Touch screen driver how to implement?

  • March 19, 2024
  • 1 reply
  • 2239 views

Hi,

 

i have a custom board with a STM32 and a Touchscreen.

The TSC is connected via I2C to the STM32.

There are other I2C slave devices connected to this I2C bus, as well.

And i have two threads, a system thread and a gui thread (where Touch GFX is running in).

 

So when a Touch is detected, the TSC is firing an interrupt and the TSC driver is reading the TSC registers.

But when i do this TSC driver stuff in a TouchController class it is executed in the gui thread, right?

So when in the system thread are I2C accesses to other I2C slaves, too, sooner or later a collision will occur.

So the only way to deal with this as i see it is:

- ISR of TSC sets a flag bTouchEvent

- in the system thead is:

  {

    if (bTouchEvent)

    {

       Read_Out_TSC_via I2c();

   }

  do_other_I2C_device_stuff

 }

-  Driver Instance of TouchController just reads a structure where Read_Out_TSC_via I2c() stored the touch. No I2C access here.

 

What do you think?

This topic has been closed for replies.
Best answer by sk-st

Sorry, wrong sub-forum.

But i did it this way and added some thread synchronization with a structure.

1 reply

sk-st
sk-stAuthorBest answer
Associate III
April 16, 2024

Sorry, wrong sub-forum.

But i did it this way and added some thread synchronization with a structure.