-
-
Save igrr/a0c3b05f16d12bdd542e0a8d943036e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "freertos/FreeRTOS.h" | |
#include "freertos/task.h" | |
#include "esp_pm.h" | |
#include "esp_clk.h" | |
#include "esp_timer.h" | |
void switch_freq(int mhz) | |
{ | |
rtc_cpu_freq_t max_freq; | |
assert(rtc_clk_cpu_freq_from_mhz(mhz, &max_freq)); | |
esp_pm_config_esp32_t pm_config = { | |
.max_cpu_freq = max_freq, | |
.min_cpu_freq = RTC_CPU_FREQ_XTAL | |
}; | |
ESP_ERROR_CHECK( esp_pm_configure(&pm_config) ); | |
printf("Waiting for frequency to be set to %d MHz...\n", mhz); | |
while (esp_clk_cpu_freq() / 1000000 != mhz) { | |
vTaskDelay(10); | |
} | |
printf("Frequency is set to %d MHz\n", mhz); | |
} | |
void app_main() | |
{ | |
switch_freq(80); | |
switch_freq(160); | |
switch_freq(80); | |
switch_freq(160); | |
} |
@JanPoppeliers please see the migration guide for v5.0: https://docs.espressif.com/projects/esp-idf/en/v5.0/esp32/migration-guides/release-5.x/system.html#esp-clock. This header is now under "esp_private/esp_clk.h"
Ok, I found it, thanks!
…On Fri, 17 Feb 2023 at 11:31, Ivan Grokhotkov ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
@JanPoppeliers <https://github.com/JanPoppeliers> please see the
migration guide for v5.0:
https://docs.espressif.com/projects/esp-idf/en/v5.0/esp32/migration-guides/release-5.x/system.html#esp-clock.
This header is now under "esp_private/esp_clk.h"
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/a0c3b05f16d12bdd542e0a8d943036e6#gistcomment-4474168>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADNRVNRDSA2MECLVQTGNHK3WX5HQRBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVA4DQNJVGM4TINFHORZGSZ3HMVZKMY3SMVQXIZI>
.
You are receiving this email because you were mentioned.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Release V5.0 the header file "esp_clk.h" no longer exists, so 'esp_clk_cpu_freq()' is no longer available.
How can the current clock frequency be retrieved in V5.0 ?