void APP_Tasks ( void ) { if (appData.LED3Toggle == true) // check if callback changed LED toggle flag { PLIB_PORTS_PinToggle(PORTS_ID_0, APP_LED3_PORT, APP_LED3_PIN); // toggle LED appData.LED3Toggle = false; // reset LED toggle flag } if (appData.LED4Toggle == true) { PLIB_PORTS_PinToggle(PORTS_ID_0, APP_LED4_PORT, APP_LED4_PIN); appData.LED4Toggle = false; } // The following System Timer functions read System Timer values directly. // Doing this will consume more PIC32 core cycles vs using the timed callback and // delay functions (SYS_TMR_CallbackPeriodic, ..._CallbackSingle, ..._DelayMS). if (SYS_TMR_TickCountGet() - appData.startTick >= SYS_TMR_TickCounterFrequencyGet()) { appData.startTick = SYS_TMR_TickCountGet(); // reset start time PLIB_PORTS_PinToggle(PORTS_ID_0, APP_LED5_PORT, APP_LED5_PIN); } /* Check the application's current state. */ switch ( appData.state ) { /* Application's initial state. */ case APP_STATE_INIT: { appData.sysTimerClientHandle1 = SYS_TMR_CallbackPeriodic(500, 0, APP_SysTimerCallback1); appData.sysTimerClientHandle2 = SYS_TMR_CallbackPeriodic(1000, 0, APP_SysTimerCallback2); appData.state = APP_STATE_IDLE; break; } case APP_STATE_IDLE: { break; } default: { break; } } }