CapSense_CheckIsWidgetActive() API will either return 1 or 0 when the button is pressed or not respectively. In your case when you release the button the 'buttonOne' will be 0 which is != "0xFFFFFFFF" && != it's previous state (0x01) so this causes entry to the 'if ' condition and display 'button release' message in the terminal.
The instructor in the video mentions that 0xFFFF is considered the original state of the CapSense (when no interaction has occurred). That to me makes sense since, for operations with the switch SW2 and the LEDs, they get triggered on a falling edge, which says their original state is HIGH. Correct me if I'm wrong but does the return value of "CapSense_CheckIsWidgetActive(CapSense_Button0__BTN)" only dictate the perception of on or off (1 or 0), while disguising the actual value of 1 and 0?
Also, given my idea of 0xFFFFFFFF being the initial off state, when the transition from (whatever the bit state is based on touch position) to the "off" state 0xFFFFFFFF, does the 32-bit registry still contain bits left over from the "touch state" by the time the "for(;;)" loop repeats itself? If so then again that makes sense why my "if" statement body ends up executing.
Thanks for reading this, Yuva,
1 of 1 people found this helpful
The video was related to capsense slider and the GetCentroidPosition() API would return 0xFF when there is no touch. But incase of CapSense_CheckIsWidgetActive() API the return value is either 0 or 1. Also this get updated after every scan. In your case since the value always ot equal to 0xFF the 'if' condition executes whenever there is change in touch status.