avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] ensuring that _delay_us() gets a compile-time double cons


From: Michael Hennebry
Subject: Re: [avr-chat] ensuring that _delay_us() gets a compile-time double constant
Date: Tue, 2 Dec 2014 18:36:05 -0600 (CST)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Tue, 2 Dec 2014, Britton Kerin wrote:

1.  Does _delay_us() need a double const, or is an int const guaranteed
   to work?    The avr libc manual just says "known const" in one place,
   but the signature     calls for a double.

_delay_us needs a double const.
It will get a double whether you give it a double or some other number.
That is what prototypes are for.
Prototypes are ordinary C.

   In file included from one_wire_slave.c:8:0:
   /home/bkerin/opt/avr/avr/include/util/delay.h: In function ‘ows_write_bit’:
   /home/bkerin/opt/avr/avr/include/util/delay.h:163:28: error:
__builtin_avr_delay_cycles expects a compile time integer constant
     __builtin_avr_delay_cycles(__ticks_dc);

My guess is that a variable or a non-constant
expression was passed to _delay_us.

--
Michael   address@hidden
"SCSI is NOT magic. There are *fundamental technical
reasons* why it is necessary to sacrifice a young
goat to your SCSI chain now and then."   --   John Woods

reply via email to

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