Code example of using Cap Sence with Interrupts

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

cross mob
Anonymous
Not applicable

I have made a daughter board that interfaces with a CY8CKit-043 prototype board (Production Product Current Tester).  I am using just three buttons and I tested the two boards interfaced using CE220891 example from Cap Sence examples and it runs great.  My question is how can I use it but with interrupts when the buttons are pressed.  The Cap Sence data sheet does mention there is interrupt, but I am not clear on how to do this.  Could I get some help on how this can be done.

Thanks

0 Likes
1 Solution
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

In the system, there is no interrupt can indicate that the button is active or no active.

The only interrupt is that when the sensor scan finished, it will be trigged.

You can handle it like the code example :

CapSense_IsWidgetActive(CapSense_BTN0_WDGT_ID) ? LED_ON : LED_OFF );

View solution in original post

0 Likes
3 Replies
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

In the system, there is no interrupt can indicate that the button is active or no active.

The only interrupt is that when the sensor scan finished, it will be trigged.

You can handle it like the code example :

CapSense_IsWidgetActive(CapSense_BTN0_WDGT_ID) ? LED_ON : LED_OFF );

0 Likes
Anonymous
Not applicable

Thank you for getting back to me I applicate your assistance in my efforts.

So I am clear i can get an interrupt when the scan is complete.  I then service the interrupt as an example with

CapSense_IsWidgetActive(CapSense_BTN0_WDGT_ID) ? LED_ON : LED_OFF );

Is this correct?  If so does this return from scan interrupt need to be cleared? 

Thanks

0 Likes
Anonymous
Not applicable

I am confused i need to run  other features like my ADC for a period of time to calculate average current and voltage, so i need the CapSence to run in back ground. How can I set up so CapSence to work say like a interrupt on a switch press.  I understand the CapSence returns an interrupt when it completed its scan but how do i get the CapSence to continuously scan and then service the interrupt when it completes its scan.  I have the unit working great but the detection is so slow i have wait to long of a time for the touch to be detected currently.  I could sure use some help on how I can get this done properly using CapSence and not switches.

0 Likes