1 Reply Latest reply on Jan 31, 2019 9:39 PM by BragadeeshV_41

    CapSense long press


      Hey everybody.


      I'm using CY8CMBR3116 CapSense IC along with PSoC 5LP MCU.


      Interfacing has been done. The application is I have to long press a CapSense button for more than 7 seconds to continue with a task.


      Can someone please help me how to implement long press? Thanks in advance.




        • 1. Re: CapSense long press



          You can use the SysTick timer (from HOST side) to clock the time interval between two events (any gesture detection application). You will need two variables to latch these events, say timestamp1 and timestamp2.


          For this application, you can configure a SysTick timer that generates an interrupt every 1 ms.  There should be a counter whose value should be decremented every time the SysTick interrupt occurs.


          The MBR3 will generate an interrupt every time there is change in the status of the buttons. So, when the button of interest is touched (turned ON), the MBR3 will generate an interrupt. You need to read the sensor status register - BUTTON_STAT - 0xaa (masked with the button of interest). If that is true, this event must be captured (time stamp1 = counter).  We need to start noting the time elapsed from the moment the button is touched. Now, when the time elapsed is greater than 7000 ms (7000 times SysTick ISR is executed), you can perform your application.


          You need to note that the next interrupt will be triggered only when the button status goes back to OFF or when some other button is touched.


          Also remember to disable the auto - reset feature in your design. If at all your design requires such a feature, you can turn it ON or OFF during run time by modifying the register DEVICE_CFG2 (0x4F).


          We have attached a sample project for this application using MBR3 Eval Kit with PSoC 4200 BLE as host. This project can be easily ported to the PSoC 5 host application. (Hoping that the Host APIs are changed according to PSoC 5 APIs )


          Please let us know in case of any further clarifications!