예제 #1
0
/* 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();
    
  }
  
}
예제 #2
0
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.
   */ 
#if 0
  DEBUG5_HIGH();
#endif

  /* enter a critical section so that the flags can be checked */
  __disable_interrupt();
  __no_operation();
  
  /* the watchdog is set at 16 seconds.
   * the battery interval rate is set a 10 seconds
   * each task checks in at the battery interval rate
   */
  UpdateWatchdogInfo();

  if ((WatchdogInfo.SppReadyToSleep &&
      WatchdogInfo.TaskDelayLockCount == 0 &&
      WatchdogInfo.DisplayMessagesWaiting == 0 &&
      WatchdogInfo.SppMessagesWaiting == 0) ||
      ShippingMode())
  {
    /* 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();

    /* If we get here then interrupts are enabled */
//    extern xTaskHandle IdleTaskHandle;
//    CheckStackUsage(IdleTaskHandle,"~IdlTsk ");
  }
  else
  {
    /* we aren't going to sleep so enable interrupts */
    __enable_interrupt();
    __no_operation();
  }

#if 0
  DEBUG5_LOW();
#endif
}
예제 #3
0
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();
    
  }
  
}