/* Delay a given number of microseconds. 
This is a busy wait delay not using energy modes to conserve power. */
Ecode_t USTIMER_DelayIntSafe(uint32_t usec)
/* Delay a given number of microseconds. 
This is a busy wait delay not using energy modes to conserve power. */
Ecode_t USTIMER_DelayIntSafe(uint32_t usec)
{
  uint64_t totalTicks;
  totalTicks = ( ( (uint64_t)freq * usec ) + 500000 ) / 1000000;
  while ( totalTicks > 65000 )
  {
    DelayTicksPolled( 65000 );
    totalTicks -= 65000;
  }
  DelayTicksPolled( (uint16_t)totalTicks );
  return ECODE_EMDRV_USTIMER_OK;
}