diff --git a/README.rst b/README.rst index c267235..18337e9 100644 --- a/README.rst +++ b/README.rst @@ -45,6 +45,25 @@ Many configurations specific to SQLite library have been set in the `sdkconfig.d The Flash size has been assumed as 4MB for SPIFFS example. Please change any of these configurations if necessary. +ESP-IDF Compatibility +--------------------- +The user KikyTokamuro indicated in the `issues `_ that you must do this changes for this component to work with **ESP-IDF v5.X.X**: + +* In the file "esp32-idf-sqlite3/CMakeLists.txt" add 'spi_flash' to REQUIRES. + +It was tested and work in **ESP-IDF v5.0.2-dirty** and **ESP-IDF v5.1.1-dirty**. + +The ESP-IDF version is handled in private_include/esp_idf_compat.h + +Without this changes this component should work with **ESP-IDF v4.X.X**. + +The `examples `_ where tested with **ESP-IDF Visual Studio Code Extension v1.6.5**. For them to work I had to do some changes: + +* In the file `main/CMakeLists.txt` the line `idf_build_component(esp32-idf-sqlite3)` must be commented. +* In the file `CMakeLists.txt` (in root) the line `include($ENV{IDF_PATH}/tools/cmake/idf.cmake)` must be commented and the line `include($ENV{IDF_PATH}/tools/cmake/project.cmake)` must be decomented. + +For the case of `sd_spi `_ example I could not make it work because of changes between version 4.X.X and 5.X.X of ESP-IDF like changing sdspi_slot_config_t to sdspi_device_config_t, which changes the structure of the data. + Issues ------ diff --git a/esp32.c b/esp32.c index f6be8a2..4ba443d 100644 --- a/esp32.c +++ b/esp32.c @@ -14,12 +14,12 @@ #include #include #include -#include #include #include #include #include "shox96_0_2.h" +#include "esp_idf_compat.h" #undef dbg_printf //#define dbg_printf(...) printf(__VA_ARGS__) diff --git a/private_include/esp_idf_compat.h b/private_include/esp_idf_compat.h new file mode 100644 index 0000000..75d8c65 --- /dev/null +++ b/private_include/esp_idf_compat.h @@ -0,0 +1,18 @@ +#ifndef ESP_IDF_COMPAT_H +#define ESP_IDF_COMPAT_H + +#if __has_include("esp_idf_version.h") +#include "esp_idf_version.h" +#endif + +#ifdef ESP_IDF_VERSION + +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) && ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0) +#include +#include +#elif ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0) && ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) +#include +#endif + +#endif /* ESP_IDF_VERSION */ +#endif /* ESP_IDF_COMPAT_H */