How to reliably determine (long touch) DETECT events with the STM8TL5x TouchSense / ProxSense state machine.
Hi. I'm working with the STM8TL52F4 MCU and its touch/proximity sensing peripheral. I made a simple touchkey sensor simulating Fig 3 AN4313 (ST App Note: Guidelines for designing touch sensing applications with projected sensors). If the sensor is touched, the STMTouch state machine (if repeatedly calling "TSL_user_Action()" and then testing "MyTKeys[(NB)].p_Data->StateId") reliably produces DETECT codes while a finger is firmly touching the sensor.
For short keypresses, it appears that the state machine DOES spit out contiguous blocks of DETECTs during finger contact with the sensor. Usually from the start, a series of CALIBRATEs, then some RELEASEs, a few DEB_DETECTs, the DETECTS, then more CALIBRATES, DEB_CALIBS and RELEASES after. Looks workable to me.
But if the keypress is longer than a second or so, along will always come intervening CALIBRATES, RELEASES, the whole family. And no more DETECTS will arrive, even as the key is still firmly pressed. And that's complicating the treatment of long keypresses, whose start and and stop times I need to initiate interrupts with. I wonder of there's some setting that might avoid those unwanted codes during long keypresses. If not, then any workaround? Thanks
