void _delay_us(double __us)
Perform a delay of __us
microseconds, using _delay_loop_1().
The macro F_CPU is supposed to be defined to a constant defining the CPU clock frequency (in Hertz).
The maximal possible delay is 768 us / F_CPU in MHz.
If the user requests a delay greater than the maximal possible one, _delay_us() will automatically call _delay_ms() instead. The user will not be informed about this case.
If the avr-gcc toolchain has __builtin_avr_delay_cycles() support, maximal possible delay is 4294967.295 us/ F_CPU in MHz. For values greater than the maximal possible delay, overflow results in no delay i.e., 0us.
Conversion of __us
into clock cycles may not always result in integer. By default, the clock cycles rounded up to next integer. This ensures that the user gets at least __us
microseconds of delay.
Alternatively, by defining the macro __DELAY_ROUND_DOWN__
, or __DELAY_ROUND_CLOSEST__
, before including this header file, the algorithm can be made to round down, or round to closest integer, respectively.
__DELAY_BACKWARD_COMPATIBLE__
must be defined before including this header file. Also, the backward compatible algorithm will be chosen if the code is compiled in a freestanding environment (GCC option -ffreestanding
), as the math functions required for rounding are not available to the compiler then.