diff options
| author | Magnus von Wachenfeldt <magnus@raketlaboratoriet.se> | 2021-11-04 14:50:39 +0100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-11-12 16:40:46 +1100 |
| commit | 6d9da27c21bcc687f868d77ffca42e4dfc234248 (patch) | |
| tree | 0d4b7b558238c108e2ed8288156fb949963e6cfd | |
| parent | ff4f1f3ab395a6be426cc1b6ce0839bf65574f45 (diff) | |
esp32: Support building with latest IDF v5.
The latest ESP-IDF v5.0-dev declares MAJOR_VERSION 5 and MINOR_VERSION 0.
timer_ll_set_alarm_enable() is also changed to timer_ll_set_alarm_value().
| -rw-r--r-- | ports/esp32/machine_timer.c | 6 | ||||
| -rw-r--r-- | ports/esp32/main/CMakeLists.txt | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/ports/esp32/machine_timer.c b/ports/esp32/machine_timer.c index 020ba4447..ea8b5965d 100644 --- a/ports/esp32/machine_timer.c +++ b/ports/esp32/machine_timer.c @@ -134,7 +134,7 @@ STATIC void machine_timer_isr(void *self_in) { #if HAVE_TIMER_LL - #if CONFIG_IDF_TARGET_ESP32 + #if CONFIG_IDF_TARGET_ESP32 && ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) device->hw_timer[self->index].update = 1; #else #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0) @@ -148,7 +148,11 @@ STATIC void machine_timer_isr(void *self_in) { #endif #endif timer_ll_clear_intr_status(device, self->index); + #if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) timer_ll_set_alarm_enable(device, self->index, self->repeat); + #else + timer_ll_set_alarm_value(device, self->index, self->repeat); + #endif #else diff --git a/ports/esp32/main/CMakeLists.txt b/ports/esp32/main/CMakeLists.txt index 3294ca7c0..68a4815d7 100644 --- a/ports/esp32/main/CMakeLists.txt +++ b/ports/esp32/main/CMakeLists.txt @@ -121,16 +121,16 @@ set(IDF_COMPONENTS xtensa ) -if(IDF_VERSION_MINOR GREATER_EQUAL 1) +if(IDF_VERSION_MINOR GREATER_EQUAL 1 OR IDF_VERSION_MAJOR GREATER_EQUAL 5) list(APPEND IDF_COMPONENTS esp_netif) endif() -if(IDF_VERSION_MINOR GREATER_EQUAL 2) +if(IDF_VERSION_MINOR GREATER_EQUAL 2 OR IDF_VERSION_MAJOR GREATER_EQUAL 5) list(APPEND IDF_COMPONENTS esp_system) list(APPEND IDF_COMPONENTS esp_timer) endif() -if(IDF_VERSION_MINOR GREATER_EQUAL 3) +if(IDF_VERSION_MINOR GREATER_EQUAL 3 OR IDF_VERSION_MAJOR GREATER_EQUAL 5) list(APPEND IDF_COMPONENTS esp_hw_support) list(APPEND IDF_COMPONENTS esp_pm) list(APPEND IDF_COMPONENTS hal) @@ -203,7 +203,7 @@ foreach(comp ${IDF_COMPONENTS}) micropy_gather_target_properties(__idf_${comp}) endforeach() -if(IDF_VERSION_MINOR GREATER_EQUAL 2) +if(IDF_VERSION_MINOR GREATER_EQUAL 2 OR IDF_VERSION_MAJOR GREATER_EQUAL 5) # These paths cannot currently be found by the IDF_COMPONENTS search loop above, # so add them explicitly. list(APPEND MICROPY_CPP_INC_EXTRA ${IDF_PATH}/components/soc/soc/${IDF_TARGET}/include) |
