/* Causes a blocking delay for 'ticks' on the timer. For example: delay(100) would cause a blocking delay for 100 ticks of the timer.  */
void delay(uint32_t ticks)
/* Causes a blocking delay for 'ticks' on the timer. For example: delay(100) would cause a blocking delay for 100 ticks of the timer.  */
void delay(uint32_t ticks)
{
  uint32_t curTicks;
  curTicks = delayTicks;
  if (ticks == 0) return;
  if (curTicks > 0xFFFFFFFF - ticks)
  {
    while (delayTicks >= curTicks)
    {
      while (delayTicks < (ticks - (0xFFFFFFFF - curTicks)));
    }
  }
  else
  {
    while ((delayTicks - curTicks) < ticks);
  }
}