avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] broken compiler/avrlibc build symptom?


From: Joerg Wunsch
Subject: Re: [avr-chat] broken compiler/avrlibc build symptom?
Date: Wed, 24 Sep 2014 09:02:53 +0200 (CEST)

Britton Kerin <address@hidden> wrote:

> Is this likely to be a symptom of a bad binutils/gcc/avrlibc build?
>  Genuine bug?

Genuine bug, yes.  In your code.  Just don't do it that way.
As Martin pointed out, the _delay_us/_delay_ms inline
functions do require a const argument (and always did).

What you can do is:

#include <stdint.h>

static void
delay_us(uint8_t us)
{
  while (--us != 0)
    _delay_us(1);
}

....
   delay_us(42);
   delay_us(43);

While this is quite customary to do in the millisecond range
(using _delay_ms(1)), it's questionable though whether your
call and computational overhead would not rather twice the
delays in the microsecond range.
-- 
cheers, Joerg               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)



reply via email to

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