PaxInstruments / t100-electronics

A single thermocouple to USB adapter.
0 stars 2 forks source link

Can the clock be redefined in the Arduino IDE? #20

Closed charlespax closed 10 years ago

charlespax commented 10 years ago

If we clock the processor at 12 MHz, it would be good if we can redefine the clock frequency through the Arduino IDE, so all the timers are correct.

kehribar commented 10 years ago

Yes, you can do that by creating a custom board by modifying the boards.txt file.

charlespax commented 10 years ago

But is there a way to change it from within an Arduino sketch

In boards.txt the clock is defined by the line ".build.f_cpu=".

Then platform.txt that value is passed to the compiler by the argument "-DF_CPU={build.f_cpu}".

In the Arduino sketch can we redefine that value with a line like this?

define build.f_cpu=12000000L

I'll do a quick test. It shouldn't matter if we're using the ATtiny and not using the Arduino IDE, but I'm still curious.

charlespax commented 10 years ago

Unfortunately, no, it cannot.