diff options
-rw-r--r-- | blinky.c | 2 | ||||
-rw-r--r-- | delay.h | 30 | ||||
-rw-r--r-- | delay_basic.h | 8 | ||||
-rw-r--r-- | lib_ws2812.c | 2 |
4 files changed, 21 insertions, 21 deletions
@@ -90,7 +90,7 @@ main (void) } ws2812_setleds (led, N_LEDS); - _delay_ms (5); // wait for 500ms. + delay_ms (5); // wait for 500ms. i++; @@ -81,8 +81,8 @@ */ #if !defined(__DOXYGEN__) -static inline void _delay_us(double __us) __attribute__((always_inline)); -static inline void _delay_ms(double __ms) __attribute__((always_inline)); +static inline void delay_us(double __us) __attribute__((always_inline)); +static inline void delay_ms(double __ms) __attribute__((always_inline)); #endif #ifndef F_CPU @@ -104,7 +104,7 @@ static inline void _delay_ms(double __ms) __attribute__((always_inline)); /** \ingroup util_delay - Perform a delay of \c __ms milliseconds, using _delay_loop_2(). + Perform a delay of \c __ms milliseconds, using delay_loop_2(). The macro F_CPU is supposed to be defined to a constant defining the CPU clock frequency (in Hertz). @@ -112,8 +112,8 @@ static inline void _delay_ms(double __ms) __attribute__((always_inline)); The maximal possible delay is 262.14 ms / F_CPU in MHz. When the user request delay which exceed the maximum possible one, - _delay_ms() provides a decreased resolution functionality. In this - mode _delay_ms() will work with a resolution of 1/10 ms, providing + delay_ms() provides a decreased resolution functionality. In this + mode delay_ms() will work with a resolution of 1/10 ms, providing delays up to 6.5535 seconds (independent from CPU frequency). The user will not be informed about decreased resolution. @@ -129,7 +129,7 @@ static inline void _delay_ms(double __ms) __attribute__((always_inline)); Alternatively, user can define __DELAY_ROUND_DOWN__ and __DELAY_ROUND_CLOSEST__ to round down and round to closest integer. - Note: The new implementation of _delay_ms(double __ms) with + Note: The new implementation of delay_ms(double __ms) with __builtin_avr_delay_cycles(unsigned long) support is not backward compatible. User can define __DELAY_BACKWARD_COMPATIBLE__ to get a backward compatible delay. Also, the backward compatible @@ -139,7 +139,7 @@ static inline void _delay_ms(double __ms) __attribute__((always_inline)); */ static inline void -_delay_ms(double __ms) +delay_ms(double __ms) { double __tmp ; #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ @@ -174,21 +174,21 @@ _delay_ms(double __ms) while(__ticks) { // wait 1/10 ms - _delay_loop_2(((F_CPU) / 4e3) / 10); + delay_loop_2(((F_CPU) / 4e3) / 10); __ticks --; } return; } else __ticks = (uint16_t)__tmp; - _delay_loop_2(__ticks); + delay_loop_2(__ticks); #endif } /** \ingroup util_delay - Perform a delay of \c __us microseconds, using _delay_loop_1(). + Perform a delay of \c __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). @@ -196,7 +196,7 @@ _delay_ms(double __ms) 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 + 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(unsigned long) @@ -211,7 +211,7 @@ _delay_ms(double __ms) Alternatively, user can define __DELAY_ROUND_DOWN__ and __DELAY_ROUND_CLOSEST__ to round down and round to closest integer. - Note: The new implementation of _delay_us(double __us) with + Note: The new implementation of delay_us(double __us) with __builtin_avr_delay_cycles(unsigned long) support is not backward compatible. User can define __DELAY_BACKWARD_COMPATIBLE__ to get a backward compatible delay. Also, the backward compatible @@ -221,7 +221,7 @@ _delay_ms(double __ms) */ static inline void -_delay_us(double __us) +delay_us(double __us) { double __tmp ; #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ @@ -251,12 +251,12 @@ _delay_us(double __us) __ticks = 1; else if (__tmp > 255) { - _delay_ms(__us / 1000.0); + delay_ms(__us / 1000.0); return; } else __ticks = (uint8_t)__tmp; - _delay_loop_1(__ticks); + delay_loop_1(__ticks); #endif } diff --git a/delay_basic.h b/delay_basic.h index ddf7ecd..199386f 100644 --- a/delay_basic.h +++ b/delay_basic.h @@ -37,8 +37,8 @@ #include <inttypes.h> #if !defined(__DOXYGEN__) -static inline void _delay_loop_1(uint8_t __count) __attribute__((always_inline)); -static inline void _delay_loop_2(uint16_t __count) __attribute__((always_inline)); +static inline void delay_loop_1(uint8_t __count) __attribute__((always_inline)); +static inline void delay_loop_2(uint16_t __count) __attribute__((always_inline)); #endif /** \file */ @@ -78,7 +78,7 @@ static inline void _delay_loop_2(uint16_t __count) __attribute__((always_inline) can be achieved. */ static inline void -_delay_loop_1(uint8_t __count) +delay_loop_1(uint8_t __count) { __asm__ volatile ( "1: dec %0" "\n\t" @@ -100,7 +100,7 @@ _delay_loop_1(uint8_t __count) milliseconds can be achieved. */ static inline void -_delay_loop_2(uint16_t __count) +delay_loop_2(uint16_t __count) { __asm__ volatile ( "1: sbiw %0,1" "\n\t" diff --git a/lib_ws2812.c b/lib_ws2812.c index 7f29425..ac00b62 100644 --- a/lib_ws2812.c +++ b/lib_ws2812.c @@ -22,7 +22,7 @@ ws2812_setleds_pin (struct RGB *ledarray, uint16_t leds, uint8_t pinmask) { WS2812_DDRREG |= pinmask; // Enable DDR ws2812_sendarray_mask ((uint8_t *) ledarray, leds + leds + leds, pinmask); - _delay_us (50); + delay_us (50); } void |