コード例 #1
0
__interrupt void TIMER0_B1_VECTOR_ISR(void)
#endif
{
  switch(__even_in_range(TB0IV,14))
  {
  case 0: break;  // No interrupt
  case 2: break;  // CCR1 not used
  case 4: break;  // CCR2 not used
  case 6: break;  // CCR3 reserved
  case 8: break;  // CCR4 reserved
  case 10: break; // CCR5 reserved
  case 12:        // CCR6
    /* INLINED because we don't want extra overhead of a function call */
    /* This requires ~10 us */
    {
      current = TB0CCR6;
      
#if DEBUG_SOFTWARE_FLL
      /* set debug pulse after reading count value */
      DEBUG3_HIGH();
#endif
      
      difference = current - previous;
      
      /* Get current dco_mod value ignoring reserved bits */
      ucs_dco_mod = (UCSCTL0 & MOD_MASK);

      if ( FirstPassComplete == 'F')
      {
        if ( difference > EXPECTED_DELTA )
        {
          DecrementMod();
        }
        else if ( difference < EXPECTED_DELTA )
        {
          IncrementMod();
        }
        
        /* Write the value to the register */
        UCSCTL0 = (ucs_dco_mod & MOD_MASK);
      }
      else
      {
        /* set flag and wait for next time */
        FirstPassComplete = 'F';
      }
      
      previous = current;
      TB0CCTL6 &= ~CCIFG;
      
#if DEBUG_SOFTWARE_FLL
      DEBUG3_LOW();
#endif
      
    }
    break;  
  default:
    break;
  }
}
コード例 #2
0
ファイル: main.c プロジェクト: Alucard3571/MetaWatch-WDS11x
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();
    
  }
  
}