Username:     
Password:     
             

Forum

# 1   2013-07-04 05:13:15 STL touch library triggers false events

fjrg76
Member
Registered: 2010-03-05
Posts: 10

STL touch library triggers false events

Hi,

While using the STL touch library I realised an error/misbehavior with it. The code I'm using is the same that is included with the library for the STM32l152 Discovery board. This is the thing:

In order to detect a touch one needs to call the TSL_Action() function. Surprisingly this function doesn't return anything, so one needs to figure out whether the touch panel was touched or not. But that's not the problem, the real issue is when a touch is detected, the library triggers the same event three times, even if your finger is miles away from the panel.

Let me show you the code that ST uses in its examples:


Code:

  

uint32_t i=0;

while(1)
{

  TSL_Action();
  i++;

  /*if touch detected by TSLibrary */
  if ((TSL_GlobalSetting.b.CHANGED) && (TSLState == TSL_IDLE_STATE))
  {
   
   /*reset TSL CHANGED FLag*/      (A)
    TSL_GlobalSetting.b.CHANGED = 0;  // <-- code enters here every 18 counts

    i=0; // <-- after every 18 counts the counter is reset

  }
  
  /*check if SLIDER has been touched*/    
  if ((SLIDER_DETECTED)&&(TSLState == TSL_IDLE_STATE))  
  {

    // do something useful ...    (B) <-- code enters here every six counts

  } 

  else if((!TSL_GlobalSetting.b.CHANGED) && (TSLState == TSL_IDLE_STATE))
  {

     // do nothing if nothing was detected

  }

} //end while(1)

In such a loop, once you get into (A) code, the library triggers the event three times, meaning that it enters into state (B) those three times. Then I added a counter (not shown here) to figure out what was going on, and I saw that after the first touch it takes six loops between events (in total, 18 counts) just for one pressing.

Does anyone have faced the same problem? Any workaround?

Thank you!!

Offline

 

Board footer