3 Replies Latest reply on Nov 12, 2018 7:36 AM by scclc_2272156

    Code example of using Cap Sence with Interrupts

      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.



        • 1. Re: Code example of using Cap Sence with Interrupts

          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 );

          • 2. Re: Code example of using Cap Sence with Interrupts

            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? 





            • 3. Re: Code example of using Cap Sence with Interrupts

              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.