This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/CC3220S-LAUNCHXL: Use GPIO for switch operations

Genius 3100 points
Part Number: CC3220S-LAUNCHXL

Tool/software: TI-RTOS

I am trying to use the GPIO's for reading a switch state(On / Off type) by using interrupts (Interrupts enabled on both edges). When the switch is turned on / off there were multiple interrupts fired in each cases and to suppress it, I disabled the interrupt up on any interrupt and re-enabled it once the interrupt is handled. However when I read the GPIO values inside the interrupt, I get inconsistent results.

For example, when the switch is turned off and the interrupt is fired, the GPIO read value inside the interrupt handler is expected to be zero, but this is not the case. Similarly when the switch is turned on, the GPIO read value gives inconsistent results (i.e sometimes it is 0 and sometimes 1).

Is this the right approach to reach switch state using GPIO's ? Or should I read the GPIO values in a loop comparing old state ?