From fa2d156d1411154ed9fa1b0c26826728e2a38092 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 26 Jan 2022 12:24:48 +0530 Subject: [PATCH] return default cpu frequency on espressif --- ports/espressif/common-hal/microcontroller/Processor.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ports/espressif/common-hal/microcontroller/Processor.c b/ports/espressif/common-hal/microcontroller/Processor.c index 500d1f6d3e..e4782c30ab 100644 --- a/ports/espressif/common-hal/microcontroller/Processor.c +++ b/ports/espressif/common-hal/microcontroller/Processor.c @@ -60,7 +60,13 @@ float common_hal_mcu_processor_get_voltage(void) { } uint32_t common_hal_mcu_processor_get_frequency(void) { - return 0; + #ifdef CONFIG_IDF_TARGET_ESP32C3 + return CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ * 1000000; + #elif defined(CONFIG_IDF_TARGET_ESP32S2) + return CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ * 1000000; + #elif defined(CONFIG_IDF_TARGET_ESP32S3) + return CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ * 1000000; + #endif } STATIC uint8_t swap_nibbles(uint8_t v) {