cancel
Showing results for 
Search instead for 
Did you mean: 

TSL library stateIDs

kokbarnabas
Associate II

Hello everybody,

I am trying to work with STM32F042G6 with TSL library but have some issues I hope that I made some minor mistake but I think I tried everíthing.

I can't get stable detection when touching.

I tried to copy a sample project but it was just a slightly improvement, still no stable detection.

I'm using STM32CubeMonitor where I watched the variables of the module. The measurement and delta datas seems good for me, at least at a touch event both of them changes relatively large. There are two stateIDs one is this in the CubeMonitor: MyTKeys_Data[0].StateId the other is in the CubeIDE: MyTKeys[0].p_Data->StateId. The first one is looks fine to me it responds good and looks like stable, but that only exists in the CubeMonitor I can't find it in the CubeIDE. The second one I can't monitor directly because on the CubeMonitor it appers only as MyTKeys[0].p_Data and that is a huge value, but it really looks like that doesn't works as responsive and stable as the first one.

uint8_t touched=0;

 if(tsl_user_Exec() != TSL_USER_STATUS_BUSY)
{
   if (MyTKeys[0].p_Data->StateId == TSL_STATEID_DETECT)
   {
      touched=1;
   }
   else
   {
      touched=0;
   }

}

With this code I monitored the touched varieble, on touch event it start some bouncing between 0 and 1.

So I ask help about how to properly set up and configure this library and to understand what happening with these variables?

Any help is greatly appreciated.

 

1 REPLY 1
Stassen.C
ST Employee

Hello kokbarnabas,

Did you try using the code from the example of the STM32F072B Discovery?

I think it will help you understand how the TSC works.

 

Regards,
Stassen

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.