35 #ifndef _UTIL_DELAY_H_
36 #define _UTIL_DELAY_H_ 1
38 #ifndef __HAS_DELAY_CYCLES
39 #define __HAS_DELAY_CYCLES 1
83 #if !defined(__DOXYGEN__)
84 static inline void _delay_us(
double __us) __attribute__((always_inline));
85 static inline void _delay_ms(
double __ms) __attribute__((always_inline));
90 # warning "F_CPU not defined for <util/delay.h>"
91 # define F_CPU 1000000UL
95 # warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed"
98 #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \
99 !defined(__DELAY_BACKWARD_COMPATIBLE__) && \
146 #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \
147 !defined(__DELAY_BACKWARD_COMPATIBLE__) && \
150 extern void __builtin_avr_delay_cycles(
unsigned long);
151 __tmp = ((F_CPU) / 1e3) * __ms;
153 #if defined(__DELAY_ROUND_DOWN__)
156 #elif defined(__DELAY_ROUND_CLOSEST__)
164 __builtin_avr_delay_cycles(__ticks_dc);
167 __tmp = ((F_CPU) / 4e3) * __ms;
170 else if (__tmp > 65535)
228 #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \
229 !defined(__DELAY_BACKWARD_COMPATIBLE__) && \
232 extern void __builtin_avr_delay_cycles(
unsigned long);
233 __tmp = ((F_CPU) / 1e6) * __us;
235 #if defined(__DELAY_ROUND_DOWN__)
238 #elif defined(__DELAY_ROUND_CLOSEST__)
246 __builtin_avr_delay_cycles(__ticks_dc);
249 __tmp = ((F_CPU) / 3e6) * __us;
252 else if (__tmp > 255)
void _delay_loop_2(uint16_t __count)
Definition: delay_basic.h:103
unsigned char uint8_t
Definition: stdint.h:79
void _delay_ms(double __ms)
Definition: delay.h:142
unsigned long int uint32_t
Definition: stdint.h:99
void _delay_us(double __us)
Definition: delay.h:224
void _delay_loop_1(uint8_t __count)
Definition: delay_basic.h:81
unsigned int uint16_t
Definition: stdint.h:89