void APP_SwitchChangeNoticed ( void ) { uint32_t __attribute__ ((unused)) temp; /* Read port to clear mismatch on change notice pins */ temp = PLIB_PORTS_Read(PORTS_ID_0, APP_CN_PORT_CHANNEL); /* Clear the interrupt flag */ SYS_INT_SourceStatusClear(APP_CN_PORT_INTERRUPT); // Test for a switch press transition and ignore switch release if (APP_CN_PRESS_EQUALS_1_OR_0 == 0) // if pressed switch puts 0 on pin { if ( !((1 << APP_CN_PORT_BIT) & temp)) // if high to low transition { /* Set flag indicating that a change has been noticed. */ appData.changeNoticed = true; } } else // pressed switch puts 1 on pin { if ( (1 << APP_CN_PORT_BIT) & temp) // if low to high transition { /* Set flag indicating that a change has been noticed. */ appData.changeNoticed = true; } } }