Skip to content

Commit

Permalink
Enhance GFX_LITE support
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcodetastic committed Jul 22, 2024
1 parent 628ffa8 commit fdc9019
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
19 changes: 10 additions & 9 deletions src/ESP32-HUB75-MatrixPanel-I2S-DMA.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// #include <Arduino.h>
#include "platforms/platform_detect.hpp"

#ifdef USE_GFX_ROOT
#include <FastLED.h>
#include "GFX.h" // Adafruit GFX core class -> https://github.com/mrfaptastic/GFX_Root
#ifdef USE_GFX_LITE
// Slimmed version of Adafruit GFX + FastLED: https://github.com/mrcodetastc/GFX_Lite
#include "GFX_Lite.h"
#elif !defined NO_GFX
#include "Adafruit_GFX.h" // Adafruit class with all the other stuff
#include "Adafruit_GFX.h" // Adafruit class with all the other stuff
#endif

/*******************************************************************************************
Expand Down Expand Up @@ -366,7 +366,8 @@ struct HUB75_I2S_CFG
}; // end of structure HUB75_I2S_CFG

/***************************************************************************************/
#ifdef USE_GFX_ROOT
#ifdef USE_GFX_LITE
// Slimmed version of Adafruit GFX + FastLED: https://github.com/mrcodetastic/GFX_Lite
class MatrixPanel_I2S_DMA : public GFX
{
#elif !defined NO_GFX
Expand All @@ -386,7 +387,7 @@ class MatrixPanel_I2S_DMA
*
*/
MatrixPanel_I2S_DMA()
#ifdef USE_GFX_ROOT
#ifdef USE_GFX_LITE
: GFX(MATRIX_WIDTH, MATRIX_HEIGHT)
#elif !defined NO_GFX
: Adafruit_GFX(MATRIX_WIDTH, MATRIX_HEIGHT)
Expand All @@ -401,7 +402,7 @@ class MatrixPanel_I2S_DMA
*
*/
MatrixPanel_I2S_DMA(const HUB75_I2S_CFG &opts)
#ifdef USE_GFX_ROOT
#ifdef USE_GFX_LITE
: GFX(opts.mx_width * opts.chain_length, opts.mx_height)
#elif !defined NO_GFX
: Adafruit_GFX(opts.mx_width * opts.chain_length, opts.mx_height)
Expand Down Expand Up @@ -572,7 +573,7 @@ class MatrixPanel_I2S_DMA
void fillScreenRGB888(uint8_t r, uint8_t g, uint8_t b);
void drawPixelRGB888(int16_t x, int16_t y, uint8_t r, uint8_t g, uint8_t b);

#ifdef USE_GFX_ROOT
#ifdef USE_GFX_LITE
// 24bpp FASTLED CRGB colour struct support
void fillScreen(CRGB color);
void drawPixel(int16_t x, int16_t y, CRGB color);
Expand Down Expand Up @@ -930,7 +931,7 @@ inline void MatrixPanel_I2S_DMA::fillScreenRGB888(uint8_t r, uint8_t g, uint8_t
updateMatrixDMABuffer(r, g, b); // RGB only (no pixel coordinate) version of 'updateMatrixDMABuffer'
}

#ifdef USE_GFX_ROOT
#ifdef USE_GFX_LITE
// Support for CRGB values provided via FastLED
inline void MatrixPanel_I2S_DMA::drawPixel(int16_t x, int16_t y, CRGB color)
{
Expand Down
18 changes: 12 additions & 6 deletions src/ESP32-VirtualMatrixPanel-I2S-DMA.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@
*******************************************************************/

#include "ESP32-HUB75-MatrixPanel-I2S-DMA.h"
#ifndef NO_GFX
#include <Fonts/FreeSansBold12pt7b.h>
#ifdef USE_GFX_LITE
// Slimmed version of Adafruit GFX + FastLED: https://github.com/mrcodetastic/GFX_Lite
#include "GFX_Lite.h"
#include <Fonts/FreeSansBold12pt7b.h>
#elif !defined NO_GFX
#include "Adafruit_GFX.h" // Adafruit class with all the other stuff
#include <Fonts/FreeSansBold12pt7b.h>
#endif


// #include <iostream>

struct VirtualCoords
Expand Down Expand Up @@ -67,7 +73,7 @@ enum PANEL_CHAIN_TYPE
CHAIN_BOTTOM_LEFT_UP_ZZ
};

#ifdef USE_GFX_ROOT
#ifdef USE_GFX_LITE
class VirtualMatrixPanel : public GFX
#elif !defined NO_GFX
class VirtualMatrixPanel : public Adafruit_GFX
Expand All @@ -78,7 +84,7 @@ class VirtualMatrixPanel

public:
VirtualMatrixPanel(MatrixPanel_I2S_DMA &disp, int _vmodule_rows, int _vmodule_cols, int _panelResX, int _panelResY, PANEL_CHAIN_TYPE _panel_chain_type = CHAIN_NONE)
#ifdef USE_GFX_ROOT
#ifdef USE_GFX_LITE
: GFX(_vmodule_cols * _panelResX, _vmodule_rows * _panelResY)
#elif !defined NO_GFX
: Adafruit_GFX(_vmodule_cols * _panelResX, _vmodule_rows * _panelResY)
Expand Down Expand Up @@ -121,7 +127,7 @@ class VirtualMatrixPanel
void clearScreen() { display->clearScreen(); }
void drawPixelRGB888(int16_t x, int16_t y, uint8_t r, uint8_t g, uint8_t b);

#ifdef USE_GFX_ROOT
#ifdef USE_GFX_LITE
// 24bpp FASTLED CRGB colour struct support
void fillScreen(CRGB color);
void drawPixel(int16_t x, int16_t y, CRGB color);
Expand Down Expand Up @@ -459,7 +465,7 @@ inline void VirtualMatrixPanel::drawPixelRGB888(int16_t x, int16_t y, uint8_t r,
this->display->drawPixelRGB888(coords.x, coords.y, r, g, b);
}

#ifdef USE_GFX_ROOT
#ifdef USE_GFX_LITE
// Support for CRGB values provided via FastLED
inline void VirtualMatrixPanel::drawPixel(int16_t x, int16_t y, CRGB color)
{
Expand Down

0 comments on commit fdc9019

Please sign in to comment.