Skip to content

Can we add an option to disable the F_CPU macro in arduino IDE? #8272

Open
@pgrAm

Description

@pgrAm

Currently the core does not provide any way to change the clock speed of the esp8266. The espressif sdk provides the function system_update_cpu_freq() but this does not play nice with the arduino core which seems to assume that the clock speed is set at compile time and never changes. Furthermore the core seems to be written to rely on the F_CPU macro, however if F_CPU is not defined there seems to be an alternate code path which would allow for speed changes on the fly. The problem is there is no way to disable this macro from inside the Arduino IDE, only to toggle it between 80 & 160 MHz.

Being able to change CPU speed at runtime would be a very useful feature especially for projects that need to conserve power but need to operate in AP mode.

I would like to ask why is changing CPU speed at runtime not supported? It would seem like all that would need to happen would be to add a third option to the "CPU Frequency" menu that disables the F_CPU macro allowing it to be toggled at runtime by system_update_cpu_freq(). Am I missing anything else that is needed?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions