esp32/modmachine: Fix deprecated esp_pm_config_XXX_t.

Co-Authored-By: Trent Piepho <35062987+xyzzy42@users.noreply.github.com>

Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
This commit is contained in:
Ihor Nehrutsa 2023-11-13 13:58:22 +02:00 committed by Damien George
parent e423b3c0ba
commit a427117d03
1 changed files with 4 additions and 0 deletions

4
ports/esp32/modmachine.c Normal file → Executable file
View File

@ -111,6 +111,9 @@ STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
mp_raise_ValueError(MP_ERROR_TEXT("frequency must be 20MHz, 40MHz, 80Mhz, 160MHz or 240MHz"));
#endif
}
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 0)
esp_pm_config_t pm;
#else
#if CONFIG_IDF_TARGET_ESP32
esp_pm_config_esp32_t pm;
#elif CONFIG_IDF_TARGET_ESP32C3
@ -120,6 +123,7 @@ STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
#elif CONFIG_IDF_TARGET_ESP32S3
esp_pm_config_esp32s3_t pm;
#endif
#endif
pm.max_freq_mhz = freq;
pm.min_freq_mhz = freq;
pm.light_sleep_enable = false;