avr-libc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-commit] [2385] Submitted by Maksim Kuleshov:


From: Joerg Wunsch
Subject: [avr-libc-commit] [2385] Submitted by Maksim Kuleshov:
Date: Fri, 03 May 2013 13:14:31 +0000

Revision: 2385
          http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2385
Author:   joerg_wunsch
Date:     2013-05-03 13:14:20 +0000 (Fri, 03 May 2013)
Log Message:
-----------
Submitted by Maksim Kuleshov:
patch #7654 include/delay.h: delay_us >255us without decreasing
resolution
* include/util/delay.h.in (_delay_us): Add a second decision
logic that decides whether _delay_loop_2() could still be
used, or the fallback to _delay_ms() is required; while here,
reorder local variables so it compiles warning-free in all
configurations

Ticket Links:
------------
    http://savannah.gnu.org/patch/?7654

Modified Paths:
--------------
    trunk/avr-libc/ChangeLog
    trunk/avr-libc/NEWS
    trunk/avr-libc/include/util/delay.h.in

Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog    2013-05-03 12:38:46 UTC (rev 2384)
+++ trunk/avr-libc/ChangeLog    2013-05-03 13:14:20 UTC (rev 2385)
@@ -1,5 +1,16 @@
 2013-05-03 Joerg Wunsch <address@hidden>
 
+       Submitted by Maksim Kuleshov:
+       patch #7654 include/delay.h: delay_us >255us without decreasing
+       resolution
+       * include/util/delay.h.in (_delay_us): Add a second decision
+       logic that decides whether _delay_loop_2() could still be
+       used, or the fallback to _delay_ms() is required; while here,
+       reorder local variables so it compiles warning-free in all
+       configurations
+
+2013-05-03 Joerg Wunsch <address@hidden>
+
        Submitted by W. Trevor King:
        patch #7826 Add ATMega32u4 support to the led-blinking demo
        * doc/examples/demo/iocompat.h: Add ATmega32U4

Modified: trunk/avr-libc/NEWS
===================================================================
--- trunk/avr-libc/NEWS 2013-05-03 12:38:46 UTC (rev 2384)
+++ trunk/avr-libc/NEWS 2013-05-03 13:14:20 UTC (rev 2385)
@@ -20,6 +20,7 @@
 * Contributed Patches:
 
   [#3729] Printf for integers speed up
+  [#7654] include/delay.h: delay_us >255us without decreasing resolution
   [#7826] Add ATMega32u4 support to the led-blinking demo
   [#7909] Adding __volatile__ to __asm__ within pgmspace header
   [#7910] Add missing PCINT2_vect to iotn40.h and update all the

Modified: trunk/avr-libc/include/util/delay.h.in
===================================================================
--- trunk/avr-libc/include/util/delay.h.in      2013-05-03 12:38:46 UTC (rev 
2384)
+++ trunk/avr-libc/include/util/delay.h.in      2013-05-03 13:14:20 UTC (rev 
2385)
@@ -141,7 +141,6 @@
 void
 _delay_ms(double __ms)
 {
-       uint16_t __ticks;
        double __tmp ; 
 #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \
   !defined(__DELAY_BACKWARD_COMPATIBLE__) &&      \
@@ -164,6 +163,7 @@
        __builtin_avr_delay_cycles(__ticks_dc);
 
 #else
+       uint16_t __ticks;
        __tmp = ((F_CPU) / 4e3) * __ms;
        if (__tmp < 1.0)
                __ticks = 1;
@@ -223,7 +223,6 @@
 void
 _delay_us(double __us)
 {
-       uint8_t __ticks;
        double __tmp ; 
 #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \
   !defined(__DELAY_BACKWARD_COMPATIBLE__) &&      \
@@ -246,12 +245,20 @@
        __builtin_avr_delay_cycles(__ticks_dc);
 
 #else
+       uint8_t __ticks;
+       double __tmp2 ; 
        __tmp = ((F_CPU) / 3e6) * __us;
+       __tmp2 = ((F_CPU) / 4e6) * __us;
        if (__tmp < 1.0)
                __ticks = 1;
+       else if (__tmp2 > 65535)
+       {
+               _delay_ms(__us / 1000.0);
+       }
        else if (__tmp > 255)
        {
-               _delay_ms(__us / 1000.0);
+               uint16_t __ticks=(uint16_t)__tmp2;
+               _delay_loop_2(__ticks);
                return;
        }
        else




reply via email to

[Prev in Thread] Current Thread [Next in Thread]