The device will not do that for you, so you will have to implement this on the C++ side. You probably want to keep track of the number of touches: store the return value of getNumTouches()
. Every time this moves from 0 to a positive number, you know that you just started touching the sensor. For instance, assuming that you are using a 1D or 2D device, the function that reads the sensors could look like this:
void loop(void*)
{
unsigned int pastTouches;
while(!Bela_stopRequested())
{
// Read locations from Trill sensor
touchSensor.readI2C();
unsigned int touches = touchSensor.getNumTouches();
if(0 == pastTouches && numActiveTouches > 0)
{
/// onset detected:
/// do your triggering in here!
}
//do more stuff here as needed (e.g.: reading touch location etc)
pastTouches = touches; // update the "past" value
usleep(gTaskSleepTime);
}
}