Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Use F_CPU if (?) CPU frequency switch is compile-time only #6833
Then ESP.getCpuFreqMHz() can be optimized to use F_CPU and be constexpr.
On review, please consider this, in
Could this be turned into dynamic frequency switching?
Nope, PR looks good.
Based on what cnlohr got when he changed the baseband PLL, the rfpll is tied to bbpll somehow and the WiFi spectrum narrowed when he slowed the CPU down. You might be able to dynamically switch, but you'd need to reprogram the WiFi as well.
edit: Nope, I'm wrong. The center frequency of Charles' tests stayed the same as did the RF envelope, so the only thing that changed was the data rate (slower CPU clock = slower data rate = narrower spectrum). Looks like you might be able to dynamically switch the CPU without regard to the WiFi programming, but SYS would need to know the CPU changed to adjust various timings.
Prepare PolledTimeout for dynamic CPU frequency - would fail to compile if F_CPU is not defined, helps as marker that something needs to be done.