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__) && \
145 #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \
146 !defined(__DELAY_BACKWARD_COMPATIBLE__) && \
149 extern void __builtin_avr_delay_cycles(
unsigned long);
150 __tmp = ((F_CPU) / 1e3) * __ms;
152 #if defined(__DELAY_ROUND_DOWN__)
155 #elif defined(__DELAY_ROUND_CLOSEST__)
163 __builtin_avr_delay_cycles(__ticks_dc);
167 __tmp = ((F_CPU) / 4e3) * __ms;
170 else if (__tmp > 65535)
227 #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \
228 !defined(__DELAY_BACKWARD_COMPATIBLE__) && \
231 extern void __builtin_avr_delay_cycles(
unsigned long);
232 __tmp = ((F_CPU) / 1e6) * __us;
234 #if defined(__DELAY_ROUND_DOWN__)
237 #elif defined(__DELAY_ROUND_CLOSEST__)
245 __builtin_avr_delay_cycles(__ticks_dc);
250 __tmp = ((F_CPU) / 3e6) * __us;
251 __tmp2 = ((F_CPU) / 4e6) * __us;
254 else if (__tmp2 > 65535)
258 else if (__tmp > 255)
void _delay_loop_2(uint16_t __count)
Definition: delay_basic.h:103
unsigned char uint8_t
Definition: stdint.h:80
void _delay_ms(double __ms)
Definition: delay.h:142
unsigned long int uint32_t
Definition: stdint.h:100
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:90