diff --git a/.github/workflows/esp-idf_with-gfx.yml b/.github/workflows/esp-idf_with-gfx.yml new file mode 100644 index 0000000..abe875b --- /dev/null +++ b/.github/workflows/esp-idf_with-gfx.yml @@ -0,0 +1,49 @@ +name: esp-idf with Adafruit GFX Library + +on: + push: + paths-ignore: + - '**.md' + - 'doc/**' + - '.github/**' + pull_request: + paths-ignore: + - '**.md' + - 'doc/**' + - '.github/**' + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + submodules: 'recursive' + - name: Checkout ESP32-HUB75-MatrixPanel-I2S-DMA component + uses: actions/checkout@v2 + with: + path: 'examples/esp-idf/with-gfx/components/ESP32-HUB75-MatrixPanel-I2S-DMA' + - name: Checkout Adafruit-GFX-Library repo + uses: actions/checkout@v2 + with: + repository: 'adafruit/Adafruit-GFX-Library' + path: 'examples/esp-idf/with-gfx/components/Adafruit-GFX-Library' + - name: Checkout Adafruit_BusIO repo + uses: actions/checkout@v2 + with: + repository: 'adafruit/Adafruit_BusIO' + path: 'examples/esp-idf/with-gfx/components/Adafruit_BusIO' + - name: Checkout arduino-esp32 repo + uses: actions/checkout@v2 + with: + repository: 'espressif/arduino-esp32' + path: 'examples/esp-idf/with-gfx/components/arduino' + - name: esp-idf build + uses: espressif/esp-idf-ci-action@v1 + with: + esp_idf_version: v4.4.4 + target: esp32 + path: 'examples/esp-idf/with-gfx' diff --git a/.github/workflows/esp-idf_without-gfx.yml b/.github/workflows/esp-idf_without-gfx.yml new file mode 100644 index 0000000..5fa06a4 --- /dev/null +++ b/.github/workflows/esp-idf_without-gfx.yml @@ -0,0 +1,34 @@ +name: esp-idf without Adafruit GFX Library + +on: + push: + paths-ignore: + - '**.md' + - 'doc/**' + - '.github/**' + pull_request: + paths-ignore: + - '**.md' + - 'doc/**' + - '.github/**' + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + submodules: 'recursive' + - name: Checkout ESP32-HUB75-MatrixPanel-I2S-DMA component + uses: actions/checkout@v2 + with: + path: 'examples/esp-idf/without-gfx/components/ESP32-HUB75-MatrixPanel-I2S-DMA' + - name: esp-idf build + uses: espressif/esp-idf-ci-action@v1 + with: + esp_idf_version: v4.4 + target: esp32 + path: 'examples/esp-idf/without-gfx' 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