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:
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?