aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrfaptastic <12006953+mrfaptastic@users.noreply.github.com>2023-05-10 18:44:41 +0100
committerGitHub <noreply@github.com>2023-05-10 18:44:41 +0100
commit8b6fb5ef23c999080262218dd73c684ded399fbe (patch)
tree012d527e8934427cdd693128b7b0b676acd61b1b
parent3a717cd7f087a08d80c812db204cb942170754b2 (diff)
parent8deca4418d60d74732cbaf1db77b9d3d0452a1db (diff)
Merge pull request #450 from abrender/fix-esp-idf
`esp-idf`: Add menuconfig option `ESP32_HUB75_USE_GFX`.
-rw-r--r--CMakeLists.txt19
-rw-r--r--Kconfig.projbuild9
-rw-r--r--src/platforms/esp32/esp32_i2s_parallel_dma.cpp5
3 files changed, 27 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e0a1898..f623f44 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,10 +5,10 @@
cmake_minimum_required(VERSION 3.5)
idf_build_get_property(target IDF_TARGET)
-if(ARDUINO_ARCH_ESP32)
- list(APPEND arduino_build arduino Adafruit-GFX-Library)
+if(ARDUINO_ARCH_ESP32 OR CONFIG_ESP32_HUB75_USE_GFX)
+ list(APPEND build_dependencies arduino Adafruit-GFX-Library)
else()
- list(APPEND esp_idf_build esp_lcd driver)
+ list(APPEND build_dependencies esp_lcd driver)
endif()
if(${target} STREQUAL "esp32s3")
@@ -17,9 +17,18 @@ endif()
idf_component_register(SRCS "src/platforms/esp32/esp32_i2s_parallel_dma.cpp" "src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp" "src/ESP32-HUB75-MatrixPanel-leddrivers.cpp" ${extra_srcs}
INCLUDE_DIRS "./src"
- REQUIRES ${arduino_build} ${esp_idf_build}
)
+# Dependencies cannot be added to the REQUIRES argument of `idf_component_register` because (according to the build process
+# listed at https://docs.espressif.com/projects/esp-idf/en/v4.2/esp32/api-guides/build-system.html#build-process)
+# `idf_component_register` is processed during the "Enumeration" stage which happens before the sdkconfig file is loaded
+# in the "Processing" stage. So if dependencies are going to be loaded based on certain CONFIG_* variables we must
+# use `target_link_libraries` instead. This is the method used by Arduino's CMakeLists.txt file.
+foreach(component_name IN LISTS build_dependencies)
+ idf_component_get_property(lib_name ${component_name} COMPONENT_LIB)
+ target_link_libraries(${COMPONENT_LIB} PUBLIC ${lib_name})
+endforeach()
+
# In case you are running into issues with "missing" header files from 3rd party libraries
# you can add them to the REQUIRES section above. If you use some of the build options below
# you probably want to remove (NO_GFX) or replace Adafruit-GFX-Library (USE_GFX_ROOT)
@@ -29,7 +38,7 @@ idf_component_register(SRCS "src/platforms/esp32/esp32_i2s_parallel_dma.cpp" "sr
# target_compile_options(${COMPONENT_TARGET} PUBLIC -DNO_GFX)
# esp-idf does not have any GFX library support yet, so we need to define NO_GFX
-if(ARDUINO_ARCH_ESP32)
+if(ARDUINO_ARCH_ESP32 OR CONFIG_ESP32_HUB75_USE_GFX)
else()
target_compile_options(${COMPONENT_TARGET} PUBLIC -DNO_GFX)
if(${target} STREQUAL "esp32s3")
diff --git a/Kconfig.projbuild b/Kconfig.projbuild
new file mode 100644
index 0000000..1668a97
--- /dev/null
+++ b/Kconfig.projbuild
@@ -0,0 +1,9 @@
+menu "ESP32 HUB75 Configuration"
+
+ config ESP32_HUB75_USE_GFX
+ bool "Use Adafruit GFX library."
+ default y
+ help
+ This option enables use of the Adafruit GFX library using the `Adafruit-GFX-Library` component.
+
+endmenu
diff --git a/src/platforms/esp32/esp32_i2s_parallel_dma.cpp b/src/platforms/esp32/esp32_i2s_parallel_dma.cpp
index 5511d6f..181503c 100644
--- a/src/platforms/esp32/esp32_i2s_parallel_dma.cpp
+++ b/src/platforms/esp32/esp32_i2s_parallel_dma.cpp
@@ -28,7 +28,10 @@ Modified heavily for the ESP32 HUB75 DMA library by:
#include <driver/periph_ctrl.h>
#include <soc/gpio_sig_map.h>
-#include <Arduino.h> // Need to make sure this is uncommented to get ESP_LOG output on (Arduino) Serial output!!!!
+#if defined (ARDUINO_ARCH_ESP32)
+#include <Arduino.h>
+#endif
+
#include <esp_err.h>
#include <esp_log.h>