This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cc2640 timer

In sensortag application code ,we can see the code below .I want to know how to guarantee 

keyRight.tStop greater than keyRight.tstart .And I want to know how to use timer interrupt.

when does the function
SensorTag_callback  execute??


(keyRight.tStop - keyRight.tStart)
void SensorTagKeys_processKeyLeft(void)
{
  if (PIN_getInputValue(Board_KEY_LEFT))
  {
    keys &= ~SK_KEY_LEFT;
    keyLeft.tStop = Clock_getTicks();
  }
  else
  {
    keys |= SK_KEY_LEFT;
    keyLeft.tStart = Clock_getTicks();
  }
  
  // Wake up the application thread
  Semaphore_post(sem);
}

 duration = ((keyRight.tStop - keyRight.tStart) * Clock_tickPeriod) 
          / 1000;



static void SensorTag_callback(PIN_Handle handle, PIN_Id pinId)
{
  switch (pinId) {

  case Board_KEY_LEFT:
    SensorTagKeys_processKeyLeft();
    break;

  case Board_KEY_RIGHT:
    SensorTagKeys_processKeyRight();
    break;

  case Board_RELAY:
    SensorTagKeys_processRelay();
    break;

  default:
    /* Do nothing */
    break;
  }
}