timer_ns2tick()

Updated: April 19, 2023

Synopsis:

unsigned long timer_ns2tick(unsigned long ns);

Arguments:

ns
The number of nanoseconds.

Description:

Convert a value in nanoseconds to hardware timer ticks, which allows you to compare it to a value returned by timer_diff().

The accuracy of the return value is dependent on the resolution of the hardware timer tick and the time it takes to read the hardware timer.

For more information and a code example that adds a wait time and converts nanoseconds to hardware timer ticks, see timer_start()

Returns:

The number of hardware timer ticks.