esp32/modmachine: Fix machine.freq to allow maximum 160MHz on ESP32-C3.

Fixes issue #8824.

Signed-off-by: Damien George <damien@micropython.org>
pull/8873/head
Damien George 2022-07-08 22:46:51 +10:00
rodzic 80bc9b3dee
commit d7a162516e
1 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -82,8 +82,16 @@ STATIC mp_obj_t machine_freq(size_t n_args, const mp_obj_t *args) {
} else {
// set
mp_int_t freq = mp_obj_get_int(args[0]) / 1000000;
if (freq != 20 && freq != 40 && freq != 80 && freq != 160 && freq != 240) {
if (freq != 20 && freq != 40 && freq != 80 && freq != 160
#if !CONFIG_IDF_TARGET_ESP32C3
&& freq != 240
#endif
) {
#if CONFIG_IDF_TARGET_ESP32C3
mp_raise_ValueError(MP_ERROR_TEXT("frequency must be 20MHz, 40MHz, 80Mhz or 160MHz"));
#else
mp_raise_ValueError(MP_ERROR_TEXT("frequency must be 20MHz, 40MHz, 80Mhz, 160MHz or 240MHz"));
#endif
}
#if CONFIG_IDF_TARGET_ESP32
esp_pm_config_esp32_t pm;