/* TODO: Add any necessary callback functions. */ /* Callback function called by the Timer System Service polls the I/O Port pin connected to the push button switch. If a switch press is detected, it will set the pressDetected flag. This will run every APP_SWITCH_READ_DELAY milliseconds. */ void APP_TimerCallback1 ( uintptr_t context, uint32_t tickCount ) { uint32_t portBits1; portBits1 = PLIB_PORTS_Read(PORTS_ID_0, APP_SWITCH_PORT); /* If pressed switch puts 0 on pin */ if (APP_PRESS_EQUALS_1_OR_0 == 0) { /* If bit connected to switch = 0 */ if ( !((1 << APP_SWITCH_BIT) & portBits1)) { appData.pressDetected = true; } } /* If pressed switch puts 1 on pin */ else { /* If bit connected to switch = 1 */ if ( (1 << APP_SWITCH_BIT) & portBits1) { appData.pressDetected = true; } } }