Add Overclocking Warnings to Processor.c

This commit is contained in:
mjs513 2022-04-16 11:01:50 -04:00
parent fd41c1ac5b
commit 0b6c451fdf

View File

@ -57,6 +57,15 @@ uint32_t common_hal_mcu_processor_set_frequency(mcu_processor_obj_t *self,
if (frequency < 24000000 || frequency > 1008000000) { if (frequency < 24000000 || frequency > 1008000000) {
mp_raise_ValueError(translate("Frequency Out of Range Must be between 24Mhz and 1.008Ghz")); mp_raise_ValueError(translate("Frequency Out of Range Must be between 24Mhz and 1.008Ghz"));
} }
if (frequency <= 600000000) {
mp_printf(&mp_plat_print, "System Clock is set to %d hz\n", frequency);
}
if (frequency > 600000000) {
mp_printf(&mp_plat_print, "System Clock is set to %d hz and is Overclocked\n", frequency);
}
if (frequency > 816000000) {
mp_printf(&mp_plat_print, "System Clock is set to %d hz and is Overclocked, Cooling Required!\n", frequency);
}
SystemCoreClock = setarmclock(frequency); SystemCoreClock = setarmclock(frequency);
return SystemCoreClock; return SystemCoreClock;
} }