-
• #2
Sure - there's nothing built-in, but it's what I use for testing:
function getClockSource() { return ["NONE","LSE","LSI","HSE"][((peek32(0x40021020)&768)>>8)]; } getClockSource();
It checks the actual registers in the chip to see what it's set to.
-
• #3
Thank you Gordon!
I listed the meaning of the abbreviations below, for any one else who might also use the snippet:
LSE = Low-speed external user clock
LSI = Low-speed internal
HSE = High-speed external user clock
According to http://www.espruino.com/Clocks the Watch Crystal will automatically be detected and used.
I don't have an oscilloscope or a frequency counter.
Is there any way to verify that the Espruino did indeed switch to the crystal like a function that prints the status?