Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
yiar_4652736
Level 1
Level 1
First like given

Hi,

I currently have CY8CKIT-046 and trying example codes that I found on the Internet. In TopDesign section, I added a second button which has exactly same Widget Details as the first. Also ports are configured and main.c file has been edited just like the first button that is in the example code. I built the code and programmed. In CapSense Tuner, device is connected and everything looks OK. But when I try to press the buttons, one of them isn't working at all. Example code works by itself.

What should I do?

Thanks.

P.S: The attached file below is the example code.

0 Likes
1 Solution
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi yiar_4652736​,

I see that you have added the example code to the attachments and not your project. Please share your project so that we can see the issue.

In the meantime, please note the following which could solve your issue.

CapSense_SetWidgetExt() only configures a particular to be scanned. This API needs to be followed by CapSense_Scan() to initiate a scan. In case you want to scan the second button, wait for the scan of first button to complete and then configure the second button using CapSense_SetWidgetExt()  and perform the scan using CapSense_Scan() .

Snippet:

uint8 i =0 ;

CapSense_Start();

CapSense_SetupWidgetExt(i,0);

CapSense_ScanExt();

for(;;)

{

if(CapSense_IsBusy() == 0)

{

     CapSense_ProcessWidget(i);

     i++;

     if(i > 1)

          i = 0;

     CapSense_SetupWidgetExt(i,0); // Assuming there is only one sensor per widget.

     CapSense_ScanExt();

}

Calling CapSense_SetupWidgetExt() one after the other will scan only the last widget that was setup using  CapSense_SetupWidgetExt().

Reference: CE210291_CapSense_P4_One_Button01 modify to multiple Buttons / Sense?

Regards,

Bragadeesh

Regards,
Bragadeesh

View solution in original post

2 Replies
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi yiar_4652736​,

I see that you have added the example code to the attachments and not your project. Please share your project so that we can see the issue.

In the meantime, please note the following which could solve your issue.

CapSense_SetWidgetExt() only configures a particular to be scanned. This API needs to be followed by CapSense_Scan() to initiate a scan. In case you want to scan the second button, wait for the scan of first button to complete and then configure the second button using CapSense_SetWidgetExt()  and perform the scan using CapSense_Scan() .

Snippet:

uint8 i =0 ;

CapSense_Start();

CapSense_SetupWidgetExt(i,0);

CapSense_ScanExt();

for(;;)

{

if(CapSense_IsBusy() == 0)

{

     CapSense_ProcessWidget(i);

     i++;

     if(i > 1)

          i = 0;

     CapSense_SetupWidgetExt(i,0); // Assuming there is only one sensor per widget.

     CapSense_ScanExt();

}

Calling CapSense_SetupWidgetExt() one after the other will scan only the last widget that was setup using  CapSense_SetupWidgetExt().

Reference: CE210291_CapSense_P4_One_Button01 modify to multiple Buttons / Sense?

Regards,

Bragadeesh

Regards,
Bragadeesh

Hi BragadeeshV_41​,

Thanks for both your answer and your reference, they do work!

0 Likes