cancel
Showing results for 
Search instead for 
Did you mean: 

Touch screen driver how to implement?

sk-st
Associate III

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?

1 ACCEPTED SOLUTION

Accepted Solutions
sk-st
Associate III

Sorry, wrong sub-forum.

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

View solution in original post

1 REPLY 1
sk-st
Associate III

Sorry, wrong sub-forum.

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