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.

CC2480 halDelay()

I'm not know MSP430 hardware very well.  The function halDelay() put me in difficult position.Who can give a detail description ,thanks!

void halDelay(uint8 msecs, uint8 sleep)
{
  // Expected scaling for msecs is 3/2, but depends on result of TimerA calibration.
  // TBD - not enough code space: uint16 stop = msecs * (TACCR0_INIT / 10) / (1000 / 10);
  uint16 stop = msecs * 3 / 2;

  HAL_DISABLE_INTERRUPTS();
  TACTL &= ~MC_1;  // Stop the timer.

  if (TAR != TACCR0_INIT)
  {
    stop += TAR;
    if (stop == TACCR0_INIT)
    {
      stop++;
    }
  }
  TACCR0 = stop;

  TACTL |= MC_1;  // Re-start the timer.
  HAL_ENABLE_INTERRUPTS();

  if (sleep)
  {
    do {
      HAL_LOW_POWER_MODE();
    } while (TACCR0 != TACCR0_INIT);
  }
}