summaryrefslogtreecommitdiff
path: root/ports/esp32/modmachine.c
diff options
context:
space:
mode:
authorTianShuang Ke <QinYUN575@Gmail.com>2024-06-27 22:36:18 +0800
committerAngus Gratton <angus@redyak.com.au>2025-07-30 10:51:29 +1000
commitca9916968c06437fa39549b0995ceb811209f994 (patch)
tree8e1b5ef2e9ce7ae79e2137708cba0a28c791a7a9 /ports/esp32/modmachine.c
parent88cb6bc818546e7fe8b862c784e1e4a6b8a12b8a (diff)
esp32: Add support for ESP32-C2 (aka ESP8684).
Includes: esp32/esp32c2: Adapt to target chip ESP32C2. esp32/esp32c2: Fix heap size is too small to enable Bluetooth. Signed-off-by: TianShuangKe <qinyun575@gmail.com> Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'ports/esp32/modmachine.c')
-rw-r--r--ports/esp32/modmachine.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ports/esp32/modmachine.c b/ports/esp32/modmachine.c
index 0d7ea44c6..06360e8e8 100644
--- a/ports/esp32/modmachine.c
+++ b/ports/esp32/modmachine.c
@@ -99,6 +99,11 @@ static mp_obj_t mp_machine_get_freq(void) {
static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
mp_int_t freq = mp_obj_get_int(args[0]) / 1000000;
+ #if CONFIG_IDF_TARGET_ESP32C2
+ if (freq != 80 && freq != 120) {
+ mp_raise_ValueError(MP_ERROR_TEXT("frequency must be 80MHz or 120MHz"));
+ }
+ #else
if (freq != 20 && freq != 40 && freq != 80 && freq != 160
#if !(CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6)
&& freq != 240
@@ -110,6 +115,7 @@ 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
}
+ #endif
esp_pm_config_t pm = {
.max_freq_mhz = freq,
.min_freq_mhz = freq,