>> -----Original Message----- >> From: >> [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] >> org] On Behalf Of Steve Franks >> Sent: Monday, December 08, 2008 5:06 PM >> To: [email protected] >> Subject: [avr-libc-dev] does delay.h really need all this junk? >> >> Y'all, >> >> I was trying to figure out why _delay_us() was eating up all my flash >> in a tiny2313, so I threw in a <link> -nodefaultlibs, and look what I >> found! Is this really just for the convinienece of using F_CPU? I >> grabbed delay_loop_2(), put it in a for() loop, and my code went from >> 4k to 1k... > > Read the documentation on _delay_us(). You need to use a constant value for > the parameter, and you need to turn optimizations on. >
Right. Well, never liked the lack of warning when you overflow anyhow. I just wrapped delay_loop_2 in a while (delay > 65535) - type loop. I can live with the minimal overhead of the while and delay-=65536 getting calc'ed a few times. I usually want a delay equal to or slightly longer than the requested value when waiting for I/O's to settle and the like anyway. Suprised no one has ever made something like this official. Interesting goodies starting to appear in the util folder, I noitce...probably been there for years (i.e. setbaud) Steve _______________________________________________ AVR-libc-dev mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-libc-dev
