aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authormrfaptastic <12006953+mrfaptastic@users.noreply.github.com>2023-05-16 21:30:50 +0100
committerGitHub <noreply@github.com>2023-05-16 21:30:50 +0100
commite27231f5ca9a26ab60ee0968ea152c338391428e (patch)
tree880bd6725c659f81a09a7c7c2fe22570c22dbf55 /examples
parent6ba7c22a63a67d6b3c39418b9bca048edf3aa37c (diff)
parentfa2cb74ba11651873b091a2a87259cc03c591cde (diff)
Merge pull request #460 from abrender/addespidfcode
Add examples & Github Actions test for ESP-IDF.
Diffstat (limited to 'examples')
-rw-r--r--examples/esp-idf/.gitignore12
-rw-r--r--examples/esp-idf/with-gfx/CMakeLists.txt10
-rw-r--r--examples/esp-idf/with-gfx/README.md17
-rw-r--r--examples/esp-idf/with-gfx/components/.gitignore4
-rw-r--r--examples/esp-idf/with-gfx/main/CMakeLists.txt5
-rw-r--r--examples/esp-idf/with-gfx/main/main.cpp14
-rw-r--r--examples/esp-idf/with-gfx/sdkconfig.defaults1
-rw-r--r--examples/esp-idf/without-gfx/CMakeLists.txt10
-rw-r--r--examples/esp-idf/without-gfx/README.md14
-rw-r--r--examples/esp-idf/without-gfx/components/.gitignore4
-rw-r--r--examples/esp-idf/without-gfx/main/CMakeLists.txt5
-rw-r--r--examples/esp-idf/without-gfx/main/main.cpp12
-rw-r--r--examples/esp-idf/without-gfx/sdkconfig.defaults1
13 files changed, 109 insertions, 0 deletions
diff --git a/examples/esp-idf/.gitignore b/examples/esp-idf/.gitignore
new file mode 100644
index 0000000..3abcf2c
--- /dev/null
+++ b/examples/esp-idf/.gitignore
@@ -0,0 +1,12 @@
+# ESP-IDF default build directory
+build
+
+# Temporary files
+*.swp
+
+# lock files for examples and components
+dependencies.lock
+
+sdkconfig*
+# Unignore sdkconfig.defaults
+!sdkconfig.defaults
diff --git a/examples/esp-idf/with-gfx/CMakeLists.txt b/examples/esp-idf/with-gfx/CMakeLists.txt
new file mode 100644
index 0000000..192eccb
--- /dev/null
+++ b/examples/esp-idf/with-gfx/CMakeLists.txt
@@ -0,0 +1,10 @@
+# This is a boilerplate top-level project CMakeLists.txt file.
+# This is the primary file which CMake uses to learn how to build the project.
+#
+# Most of the important stuff happens in the 'main' directory.
+#
+# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#example-project for more details.
+cmake_minimum_required(VERSION 3.5)
+
+include($ENV{IDF_PATH}/tools/cmake/project.cmake)
+project(with-gfx)
diff --git a/examples/esp-idf/with-gfx/README.md b/examples/esp-idf/with-gfx/README.md
new file mode 100644
index 0000000..07565f9
--- /dev/null
+++ b/examples/esp-idf/with-gfx/README.md
@@ -0,0 +1,17 @@
+# ESP-IDF Example With Adafruit GFX Library
+
+This folder contains example code for using this library with `esp-idf` and the [Adafruit GFX library](https://github.com/adafruit/Adafruit-GFX-Library).
+
+First, follow the [Getting Started Guide for ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html) to install ESP-IDF onto your computer.
+
+When you are ready to start your first project with this library, follow folow these steps:
+
+ 1. Copy the files in this folder (and sub folders) into a new directory for your project.
+ 1. Clone the required repositories:
+ ```
+ git clone https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA.git components/ESP32-HUB75-MatrixPanel-I2S-DMA
+ git clone https://github.com/adafruit/Adafruit-GFX-Library.git components/Adafruit-GFX-Library
+ git clone https://github.com/adafruit/Adafruit_BusIO.git components/Adafruit_BusIO
+ git clone https://github.com/espressif/arduino-esp32.git components/arduino
+ ```
+ 1. Build your project: `idf.py build`
diff --git a/examples/esp-idf/with-gfx/components/.gitignore b/examples/esp-idf/with-gfx/components/.gitignore
new file mode 100644
index 0000000..5e7d273
--- /dev/null
+++ b/examples/esp-idf/with-gfx/components/.gitignore
@@ -0,0 +1,4 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore
diff --git a/examples/esp-idf/with-gfx/main/CMakeLists.txt b/examples/esp-idf/with-gfx/main/CMakeLists.txt
new file mode 100644
index 0000000..16901f0
--- /dev/null
+++ b/examples/esp-idf/with-gfx/main/CMakeLists.txt
@@ -0,0 +1,5 @@
+idf_component_register(
+ SRC_DIRS "." ${SRCDIRS}
+ INCLUDE_DIRS ${INCLUDEDIRS}
+ REQUIRES ESP32-HUB75-MatrixPanel-I2S-DMA
+ )
diff --git a/examples/esp-idf/with-gfx/main/main.cpp b/examples/esp-idf/with-gfx/main/main.cpp
new file mode 100644
index 0000000..7672dc5
--- /dev/null
+++ b/examples/esp-idf/with-gfx/main/main.cpp
@@ -0,0 +1,14 @@
+#include "ESP32-HUB75-MatrixPanel-I2S-DMA.h"
+
+MatrixPanel_I2S_DMA *dma_display = nullptr;
+
+extern "C" void app_main() {
+ HUB75_I2S_CFG mxconfig(/* width = */ 64, /* height = */ 64, /* chain = */ 1);
+
+ dma_display = new MatrixPanel_I2S_DMA(mxconfig);
+ dma_display->begin();
+ dma_display->setBrightness8(80);
+ dma_display->clearScreen();
+ // `println` is only available when the Adafruit GFX library is used.
+ dma_display->println("Test message");
+}
diff --git a/examples/esp-idf/with-gfx/sdkconfig.defaults b/examples/esp-idf/with-gfx/sdkconfig.defaults
new file mode 100644
index 0000000..879d223
--- /dev/null
+++ b/examples/esp-idf/with-gfx/sdkconfig.defaults
@@ -0,0 +1 @@
+CONFIG_FREERTOS_HZ=1000
diff --git a/examples/esp-idf/without-gfx/CMakeLists.txt b/examples/esp-idf/without-gfx/CMakeLists.txt
new file mode 100644
index 0000000..9fbb7f4
--- /dev/null
+++ b/examples/esp-idf/without-gfx/CMakeLists.txt
@@ -0,0 +1,10 @@
+# This is a boilerplate top-level project CMakeLists.txt file.
+# This is the primary file which CMake uses to learn how to build the project.
+#
+# Most of the important stuff happens in the 'main' directory.
+#
+# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#example-project for more details.
+cmake_minimum_required(VERSION 3.5)
+
+include($ENV{IDF_PATH}/tools/cmake/project.cmake)
+project(without-gfx)
diff --git a/examples/esp-idf/without-gfx/README.md b/examples/esp-idf/without-gfx/README.md
new file mode 100644
index 0000000..f428b23
--- /dev/null
+++ b/examples/esp-idf/without-gfx/README.md
@@ -0,0 +1,14 @@
+# ESP-IDF Example Without Adafruit GFX Library
+
+This folder contains example code for using this library with `esp-idf`.
+
+First, follow the [Getting Started Guide for ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html) to install ESP-IDF onto your computer.
+
+When you are ready to start your first project with this library, follow folow these steps:
+
+ 1. Copy the files in this folder (and sub folders) into a new directory for your project.
+ 1. Clone the required repositories:
+ ```
+ git clone https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA.git components/ESP32-HUB75-MatrixPanel-I2S-DMA
+ ```
+ 1. Build your project: `idf.py build`
diff --git a/examples/esp-idf/without-gfx/components/.gitignore b/examples/esp-idf/without-gfx/components/.gitignore
new file mode 100644
index 0000000..5e7d273
--- /dev/null
+++ b/examples/esp-idf/without-gfx/components/.gitignore
@@ -0,0 +1,4 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore
diff --git a/examples/esp-idf/without-gfx/main/CMakeLists.txt b/examples/esp-idf/without-gfx/main/CMakeLists.txt
new file mode 100644
index 0000000..16901f0
--- /dev/null
+++ b/examples/esp-idf/without-gfx/main/CMakeLists.txt
@@ -0,0 +1,5 @@
+idf_component_register(
+ SRC_DIRS "." ${SRCDIRS}
+ INCLUDE_DIRS ${INCLUDEDIRS}
+ REQUIRES ESP32-HUB75-MatrixPanel-I2S-DMA
+ )
diff --git a/examples/esp-idf/without-gfx/main/main.cpp b/examples/esp-idf/without-gfx/main/main.cpp
new file mode 100644
index 0000000..c44b49c
--- /dev/null
+++ b/examples/esp-idf/without-gfx/main/main.cpp
@@ -0,0 +1,12 @@
+#include "ESP32-HUB75-MatrixPanel-I2S-DMA.h"
+
+MatrixPanel_I2S_DMA *dma_display = nullptr;
+
+extern "C" void app_main() {
+ HUB75_I2S_CFG mxconfig(/* width = */ 64, /* height = */ 64, /* chain = */ 1);
+
+ dma_display = new MatrixPanel_I2S_DMA(mxconfig);
+ dma_display->begin();
+ dma_display->setBrightness8(80);
+ dma_display->clearScreen();
+}
diff --git a/examples/esp-idf/without-gfx/sdkconfig.defaults b/examples/esp-idf/without-gfx/sdkconfig.defaults
new file mode 100644
index 0000000..57aec4a
--- /dev/null
+++ b/examples/esp-idf/without-gfx/sdkconfig.defaults
@@ -0,0 +1 @@
+CONFIG_ESP32_HUB75_USE_GFX=n