# lib/delay.c File Reference

Architecture-independent delay-related functions. More...

`#include <delay.h>`
`#include <util.h>`

Include dependency graph for delay.c:

Go to the source code of this file.

## Functions
unsigned int | ns2cyc (unsigned int ns, unsigned int rate)
| Convert from nanoseconds to clock cycles using 32-bit arithmetic.

## Detailed Description

Architecture-independent delay-related functions.

- Compiler: IAR EWAVR32 and GNU GCC for AVR32
- Supported devices: All devices
- AppNote:

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file delay.c.

## Function Documentation

unsigned int ns2cyc | ( | unsigned int | ns,
|  | unsigned int | rate |
| ) |  |  |

Convert from nanoseconds to clock cycles using 32-bit arithmetic.

Parameters:

  | ns | Number of nanoseconds
  | rate | Clock rate in Hz

Returns:
  (ns * rate) / 1000000000

Definition at line 53 of file delay.c.

References div_ceil.