On Wed, Mar 04, 2009 at 04:37:22PM -0500, David VanHorn wrote:
> >
> > F_CPU is always evaluated upon each invocation, so if you ever
> > change it within one compilation unit, the next invocation of one of
> > these macros will reflect this.
> >
> That's compile-time, he's looking for execution-time changes in
> processor speed.
> He didn't explicitly say so, but I think he's using xdiv to scale the
> CPU clock.
But doesn't say clock is infinitely variable. Most likely there are two
frequencies he's running but this is expandable:
if( frequency == LOW_KHZ ) {
#define SAVED_F_CPU F_CPU
#undef F_CPU
#define F_CPU LOW_KHZ
_delay_us(us);
#undef F_CPU
#define F_CPU SAVED_F_CPU
#undef SAVED_F_CPU
} else {
do_delay(us);
}
--
David Kelly N4HHE, [email protected]
========================================================================
Whom computers would destroy, they must first drive mad.
_______________________________________________
AVR-GCC-list mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list