Microsecond Delay

Description

Microsecond delay function.

Functions

void sl_udelay_wait (unsigned us)
 Delay a number of microseconds.
 

Function Documentation

◆ sl_udelay_wait()

void sl_udelay_wait ( unsigned  us)

Delay a number of microseconds.

This function will use a busy loop to delay code execution by a certain number of microseconds before returning to the caller. This function will not return to the caller earlier than the time given as the input parameter. This function will not use any hardware timing peripherals, it is using the core clock frequency to calculate the delay.

Note that there will always be some overhead associated with calling this function in addition to the internal delay loop. This overhead is relatively small when the delay is large (>= 100us).

The accuracy of this delay loop will be affected by interrupts and context switching. If accuracy is needed, a hardware timer should be used to handle delays.

Parameters
[in]usThis is the number of microseconds to delay execution. This function will return after this amount of time has elapsed. Minimum value is 0 us and maximum value is 100 000 us (100 ms). It is however recommended to use the sleeptimer api for delays of more than 1 ms as it is using a hardware counter and will result in better accuracy.