Ejemplo n.º 1
0
/******************************************************************************
* Keyboard Enable/Disable key scanning timer. 
* Used for Low Power mode
*
* Parameters:
*   bool_t enable: TRUE  - The Key Scan is enabled
*                  FALSE - The Key Scan is disabled
******************************************************************************/
void KBD_EnableDisableKeyScan(bool_t enable)
{

 if(mKeyScanTimerID != gTmrInvalidTimerID_c)
 {  
  if(enable == TRUE) 
  {     
    TMR_EnableTimer(mKeyScanTimerID);   
  }
  else
  {
    if(CRM_WU_CNTL.extWuIEn  == gSWITCH_MASK_c)
    {
     /* disable scan timer here only if the KBD interrupts are all enabled.
      * With this timer disabled, the low power mode can be enetered. 
      * with the KBD interrupts disabled, the callback won't be called at the exist from low power
      */
     TMR_StopTimer(mKeyScanTimerID);
    }
  }
 }
 #if (gJoystickSupported_d == TRUE) 
  mPollTimerState = enable;
 #endif 
}
Ejemplo n.º 2
0
void TMR_StartTimer
(
tmrTimerID_t timerID,                       /* IN: */
tmrTimerType_t timerType,                   /* IN: */
tmrTimeInMilliseconds_t timeInMilliseconds, /* IN: */
void (*pfTimerCallBack)(tmrTimerID_t)       /* IN: */
)
{
  tmrTimerTicks32_t intervalInTicks;
  
  /* Stopping an already stopped timer is harmless. */
  TMR_StopTimer(timerID);
  
  intervalInTicks = TmrTicksFromMilliseconds(timeInMilliseconds);
  if (!intervalInTicks) {
    intervalInTicks = 1;
  }
  
  TMR_SetTimerType(timerID, timerType);
  maTmrTimerTable[timerID].intervalInTicks = intervalInTicks;
  maTmrTimerTable[timerID].remainingTicks = intervalInTicks;
  maTmrTimerTable[timerID].pfCallBack = pfTimerCallBack;
 
  /* Enable timer, the timer task will do the rest of the work. */
  TMR_EnableTimer(timerID);
}                                       /* TMR_StartTimer() */