Exemplo n.º 1
0
void lpc24xx_micro_seconds_delay(unsigned us)
{
  unsigned start = lpc24xx_timer();
  unsigned delay = us * (LPC24XX_CCLK / 1000000);
  unsigned elapsed = 0;

  do {
    elapsed = lpc24xx_timer() - start;
  } while (elapsed < delay);
}
void lpc24xx_micro_seconds_delay(unsigned us)
{
  unsigned start = lpc24xx_timer();
  unsigned end = start + us * (lpc24xx_cclk() / 1000000);
  unsigned now = 0;

  do {
    now = lpc24xx_timer();
  } while (now < end);
}
Exemplo n.º 3
0
uint32_t benchmark_timer_read(void)
{
  uint32_t delta = lpc24xx_timer() - benchmark_timer_base;

  if (benchmark_timer_find_average_overhead) {
    return delta;
  } else {
    /* Value determined by tmck for NCS board */
    if (delta > 74) {
      return delta - 74;
    } else {
      return 0;
    }
  }
}
Exemplo n.º 4
0
void benchmark_timer_initialize(void)
{
  benchmark_timer_base = lpc24xx_timer();
}