Tool/software: Code Composer Studio
Hi TI,
There is a button, BTN-1 on the CC1350 launchpad, and I would like to perform Long press, double press and triple press functions. My codes are as below;
if (PIN_registerIntCb(PCPinHandle, &PCCallbackFxn) != 0) { /* Error registering PC callback function */ while(1); } void PCCallbackFxn(PIN_Handle handle, PIN_Id pinId) { /* Debounce logic, only toggle if the button is still pushed (low) */ CPUdelay(80 * 8000); switch (pinId) { case Board_PIN_BUTTON0: CPUdelay(100 * 8000); if (!PIN_getInputValue(Board_PIN_BUTTON0)) { //Button0 still keep pressed, long press? CPUdelay(1200 * 8000); if (!PIN_getInputValue(Board_PIN_BUTTON0)) { //long press detected //LONG PRESS FUNCTION } } else { //short press detected clickCount++; CPUdelay(3000 * 8000); if (clickCount > 2) { //Triple click //TRIPLE CLICK FUNCTION clickCount = 0; } if (clickCount == 2) { //double click //DOUBLE CLICK FUNCTION clickCount = 0; } } break; } }
At this moment, Long Press is fine, but I have to double-click 2 times (totally 4 click) to trigger double click function, and I cannot trigger triple click fucntion.
Would you please provide us some hint on that?
Wishes,
Andy