/* The following function exists to put the MCU to sleep when in the idle task. */ void vApplicationIdleHook(void) { Housekeeping(); /* Put the processor to sleep if the serial port indicates it is OK, * the command task does not have anything to process, and * all of the queues are empty. * * This will stop the OS scheduler. */ FreeBuffers = QueueHandles[FREE_QINDEX]->uxMessagesWaiting; if ( SerialPortReadyToSleep() && CommandTaskReadyToSleep() && GetTaskDelayLockCount() == 0 && (FreeBuffers == NUM_MSG_BUFFERS) ) { extern xTaskHandle IdleTaskHandle; CheckStackUsage(IdleTaskHandle,"Idle Task"); /* Call MSP430 Utility function to enable low power mode 3. */ /* Put OS and Processor to sleep. Will need an interrupt */ /* to wake us up from here. */ MSP430_LPM_ENTER(); } }
/* 8 us */ void UpdateWatchdogInfo(void) { WatchdogInfo.SppReadyToSleep = SerialPortReadyToSleep(); WatchdogInfo.DisplayMessagesWaiting = QueueHandles[DISPLAY_QINDEX]->uxMessagesWaiting; WatchdogInfo.SppMessagesWaiting = QueueHandles[WRAPPER_QINDEX]->uxMessagesWaiting; }
/* 8 us */ void UpdateWatchdogInfo(void) { WatchdogInfo.SppReadyToSleep = SerialPortReadyToSleep(); WatchdogInfo.TaskDelayLockCount = GetTaskDelayLockCount(); WatchdogInfo.DisplayMessagesWaiting = QueueHandles[DISPLAY_QINDEX]->uxMessagesWaiting; WatchdogInfo.SppMessagesWaiting = QueueHandles[SPP_TASK_QINDEX]->uxMessagesWaiting; }
void vApplicationIdleHook(void) { /* Put the processor to sleep if the serial port indicates it is OK and * all of the queues are empty. * * This will stop the OS scheduler. */ SppReadyToSleep = SerialPortReadyToSleep(); TaskDelayLockCount = GetTaskDelayLockCount(); AllTaskQueuesEmptyFlag = AllTaskQueuesEmpty(); #if 0 if ( SppReadyToSleep ) { DEBUG3_HIGH(); } else { DEBUG3_LOW(); } #endif if ( SppReadyToSleep && TaskDelayLockCount == 0 && AllTaskQueuesEmptyFlag ) { extern xTaskHandle IdleTaskHandle; CheckStackUsage(IdleTaskHandle,"Idle Task"); /* Call MSP430 Utility function to enable low power mode 3. */ /* Put OS and Processor to sleep. Will need an interrupt */ /* to wake us up from here. */ MSP430_LPM_ENTER(); } }