Regarding a way to scan only some capsense widgets of all widgets.

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.
YuMa_1534086
Level 7
Level 7
Distributor - Macnica (Japan)
500 replies posted 250 sign-ins 10 likes received

Hello Cypress.

I would like to scan only some capsense widgets of all widgets.

Attached project has 5 capsense widgets.

I would like to scan only 2 widgets of button0 and button4.

But only button4 can scan in this project.

Button0 did not scan.

I used CY8CKIT-145-40xx.

How should attached project be modified?

Best Regards.

Yutaka Matsubara.

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

Hi YuMa_1534086​,

If you call the API CapSense_SetupWidget(); multiple times (one after the other), then only the widget that is setup last is scanned. For example, in your case, you are setting up the button 4 at last, that is why you see that only button 4 is scanned.

The correct sequence is :

1. Set up the widget to be scanned using CapSense_SetupWidget();

2. Start the scan using CapSense_Scan();

3. Wait for scan to complete using  CapSense_IsBusy();

4. Process the scanned widget using CapSense_ProcessWidget();

5. Increment/ Change the widgetID to next widget to be scanned.

6. Go to step 1.

For example, you can do the following:

widgetID = 0;

CapSense_Start();

CapSense_SetupWidget(widgetID);

CapSense_Scan();

          if(CapSense_NOT_BUSY == CapSense_IsBusy())

          {

               CapSense_ProcessWidget(widgetID);

               if(CapSense_IsAnyWidgetActive())

               { //Application

               }

               widgetID ++; // Or the next widget you want to scan.

           

               if(widgetID > maxWidgetID) // Based on your application

               {

                    widgetID = 0;

               }

               CapSense_SetupWidget(widgetID);

               CapSense_Scan();

          }

Regards,

Bragadeesh

Regards,
Bragadeesh

View solution in original post

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

Hi YuMa_1534086​,

If you call the API CapSense_SetupWidget(); multiple times (one after the other), then only the widget that is setup last is scanned. For example, in your case, you are setting up the button 4 at last, that is why you see that only button 4 is scanned.

The correct sequence is :

1. Set up the widget to be scanned using CapSense_SetupWidget();

2. Start the scan using CapSense_Scan();

3. Wait for scan to complete using  CapSense_IsBusy();

4. Process the scanned widget using CapSense_ProcessWidget();

5. Increment/ Change the widgetID to next widget to be scanned.

6. Go to step 1.

For example, you can do the following:

widgetID = 0;

CapSense_Start();

CapSense_SetupWidget(widgetID);

CapSense_Scan();

          if(CapSense_NOT_BUSY == CapSense_IsBusy())

          {

               CapSense_ProcessWidget(widgetID);

               if(CapSense_IsAnyWidgetActive())

               { //Application

               }

               widgetID ++; // Or the next widget you want to scan.

           

               if(widgetID > maxWidgetID) // Based on your application

               {

                    widgetID = 0;

               }

               CapSense_SetupWidget(widgetID);

               CapSense_Scan();

          }

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes
YuMa_1534086
Level 7
Level 7
Distributor - Macnica (Japan)
500 replies posted 250 sign-ins 10 likes received

Bragadeesh-san.

Thank you for your answer.

I understand.

Best Regards.

Yutaka Matsubara

0 Likes