|
From: | Dave N6NZ |
Subject: | Re: [avr-gcc-list] Using delay functions with variable F_CPU clock? |
Date: | Wed, 04 Mar 2009 13:50:56 -0800 |
User-agent: | Thunderbird 1.5 (X11/20051201) |
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.
Sure, but he can create wrappers: fast_clk_delay(100); slow_clock_delay(100); and so forth. If the selection must be made at run time, that can be done with a switch() statement that knows the current clock speed.
-dave
[Prev in Thread] | Current Thread | [Next in Thread] |