Return to using Adafruit_GFX
Actual testing has revealed that GFX_Root doesn't actually save any program or memory. Apparently uses more according to the compiler. Defaulting the library back to Adafruit GFX. With Adafruit GFX: Sketch uses 801298 bytes (61%) of program storage space. Maximum is 1310720 bytes. Global variables use 48992 bytes (14%) of dynamic memory, leaving 278688 bytes for local variables. Maximum is 327680 bytes. With GFX_Root: Sketch uses 804962 bytes (61%) of program storage space. Maximum is 1310720 bytes. Global variables use 49008 bytes (14%) of dynamic memory, leaving 278672 bytes for local variables. Maximum is 327680 bytes.
This commit is contained in:
parent
d623f181a9
commit
a0b6f0d493
2 changed files with 55 additions and 30 deletions
|
@ -1,56 +1,56 @@
|
|||
#ifndef _ESP32_RGB_64_32_MATRIX_PANEL_I2S_DMA
|
||||
#define _ESP32_RGB_64_32_MATRIX_PANEL_I2S_DMA
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "freertos/queue.h"
|
||||
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp32_i2s_parallel.h"
|
||||
|
||||
#include "GFX.h" // Adafruit GFX core class -> https://github.com/mrfaptastic/GFX_Root
|
||||
|
||||
/***************************************************************************************/
|
||||
/* Library compile-time options */
|
||||
/* COMPILE-TIME OPTIONS - CONFIGURE AS DESIRED */
|
||||
/***************************************************************************************/
|
||||
|
||||
// Enable serial debugging of the library, to see how memory is allocated etc.
|
||||
/* Enable serial debugging of the library, to see how memory is allocated etc. */
|
||||
//#define SERIAL_DEBUG 1
|
||||
|
||||
// Experimental: Split the framebuffer into two smaller memory allocations.
|
||||
// Can allow a bigger resolution due to the fragmented memory
|
||||
// map of the typical arduino sketch even before setup().
|
||||
//#define SPLIT_MEMORY_MODE 1
|
||||
/* Split the framebuffer into two smaller memory allocations. Can allow for
|
||||
* bigger resolution due to the fragmented memory map of the typical Arduino sketch
|
||||
* even before setup(). Enabled by default.
|
||||
*/
|
||||
#define SPLIT_MEMORY_MODE 1
|
||||
|
||||
/***************************************************************************************/
|
||||
/* HUB75 RGB pixel WIDTH and HEIGHT.
|
||||
/* Use GFX_Root (https://github.com/mrfaptastic/GFX_Root) instead of
|
||||
* Adafruit_GFX library. No real benefit unless you don't want Bus_IO library.
|
||||
*/
|
||||
//#define USE_GFX_ROOT 1
|
||||
|
||||
|
||||
/* Physical / Chained HUB75(s) RGB pixel WIDTH and HEIGHT.
|
||||
*
|
||||
* This library has only been tested with a 64 pixel (wide) and 32 (high) RGB panel.
|
||||
* Theoretically, if you want to chain two of these horizontally to make a 128x32 panel
|
||||
* you can do so with the cable and then set the MATRIX_WIDTH to '128'.
|
||||
*
|
||||
* Also, if you use a 64x64 panel, then set the MATRIX_HEIGHT to '64'; it will work!
|
||||
* Also, if you use a 64x64 panel, then set the MATRIX_HEIGHT to '64' and an E_PIN; it will work!
|
||||
*
|
||||
* All of this is memory permitting of course (dependant on your sketch etc.) ...
|
||||
*
|
||||
*/
|
||||
#ifndef MATRIX_HEIGHT
|
||||
#define MATRIX_HEIGHT 32
|
||||
#define MATRIX_HEIGHT 32
|
||||
#endif
|
||||
|
||||
#ifndef MATRIX_WIDTH
|
||||
#define MATRIX_WIDTH 64
|
||||
#define MATRIX_WIDTH 64
|
||||
#endif
|
||||
|
||||
#ifndef PIXEL_COLOR_DEPTH_BITS
|
||||
#define PIXEL_COLOR_DEPTH_BITS 8 // 8bit per RGB color = 24 bit/per pixel, reduce to save RAM
|
||||
#endif
|
||||
|
||||
#ifndef MATRIX_ROWS_IN_PARALLEL
|
||||
#define MATRIX_ROWS_IN_PARALLEL 2
|
||||
#define MATRIX_ROWS_IN_PARALLEL 2 // Don't change this unless you know what you're doing
|
||||
#endif
|
||||
|
||||
#define PIXEL_COLOR_DEPTH_BITS 8 // 8bit per RGB color = 24 bit/per pixel, reduce to save RAM
|
||||
|
||||
/***************************************************************************************/
|
||||
/* ESP32 Pin Definition. You can change this, but best if you keep it as is... */
|
||||
|
||||
/* ESP32 Default Pin definition. You can change this, but best if you keep it as is and provide custom pin mappings
|
||||
* as part of the begin(...) function.
|
||||
*/
|
||||
#define R1_PIN_DEFAULT 25
|
||||
#define G1_PIN_DEFAULT 26
|
||||
#define B1_PIN_DEFAULT 27
|
||||
|
@ -70,8 +70,26 @@
|
|||
|
||||
// Interesting Fact: We end up using a uint16_t to send data in parallel to the HUB75... but
|
||||
// given we only map to 14 physical output wires/bits, we waste 2 bits.
|
||||
|
||||
/***************************************************************************************/
|
||||
/* Keep this as is. Do not change. */
|
||||
/* Do not change. */
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "freertos/queue.h"
|
||||
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp32_i2s_parallel.h"
|
||||
|
||||
#ifdef USE_GFX_ROOT
|
||||
#include "GFX.h" // Adafruit GFX core class -> https://github.com/mrfaptastic/GFX_Root
|
||||
#else
|
||||
#include "Adafruit_GFX.h" // Adafruit class with all the other stuff
|
||||
#endif
|
||||
|
||||
/***************************************************************************************/
|
||||
/* Do not change. */
|
||||
|
||||
// Panel Upper half RGB (numbering according to order in DMA gpio_bus configuration)
|
||||
#define BIT_R1 (1<<0)
|
||||
|
@ -156,7 +174,12 @@ typedef struct rgb_24 {
|
|||
|
||||
|
||||
/***************************************************************************************/
|
||||
#ifdef USE_GFX_ROOT
|
||||
class RGB64x32MatrixPanel_I2S_DMA : public GFX {
|
||||
#else
|
||||
class RGB64x32MatrixPanel_I2S_DMA : public Adafruit_GFX {
|
||||
#endif
|
||||
|
||||
// ------- PUBLIC -------
|
||||
public:
|
||||
|
||||
|
@ -167,7 +190,11 @@ class RGB64x32MatrixPanel_I2S_DMA : public GFX {
|
|||
*
|
||||
*/
|
||||
RGB64x32MatrixPanel_I2S_DMA(bool _double_buffer = false)
|
||||
#ifdef USE_GFX_ROOT
|
||||
: GFX(MATRIX_WIDTH, MATRIX_HEIGHT), double_buffering_enabled(_double_buffer) {
|
||||
#else
|
||||
: Adafruit_GFX(MATRIX_WIDTH, MATRIX_HEIGHT), double_buffering_enabled(_double_buffer) {
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# HUB75 LED matrix library for the ESP32, utilising DMA
|
||||
|
||||
#### Note: Change with new version! Dependancy on [GFX_Root](https://github.com/ZinggJM/GFX_Root) from the "Library > Manage Libraries" menu. ####
|
||||
|
||||
This ESP32 Arduino library for an RGB LED (HUB 75 type) Matrix Panel, utilises the DMA functionality provided by the ESP32's I2S 'LCD Mode' which basically means that pixel data is sent straight from memory, via the DMA controller, to the relevant LED Matrix GPIO pins with little CPU overhead.
|
||||
|
||||
As a result, this library can theoretically provide ~16-24 bit colour, at various brightness levels without noticeable flicker.
|
||||
|
@ -10,7 +8,7 @@ As a result, this library can theoretically provide ~16-24 bit colour, at variou
|
|||
|
||||
# Installation
|
||||
|
||||
* Dependency: You will need to install [GFX_Root](https://github.com/ZinggJM/GFX_Root) from the "Library > Manage Libraries" menu.
|
||||
* Dependency: You will need to install Adafruit_GFX from the "Library > Manage Libraries" menu.
|
||||
* Download and unzip this repository into your Arduino/libraries folder (or better still, use the Arduino 'add library from .zip' option.
|
||||
* Library also tested to work fine with PlatformIO, install into your PlatformIO projects' lib/ folder as appropriate.
|
||||
|
||||
|
|
Loading…
Reference in a new issue