Update VirtualMatrixPanel class

This commit is contained in:
mrfaptastic 2021-03-31 18:29:03 +01:00
parent 5062df590e
commit 4af72ab98d
2 changed files with 15 additions and 22 deletions

View file

@ -14,19 +14,10 @@
*/ */
//#define NO_FAST_FUNCTIONS //#define NO_FAST_FUNCTIONS
/*
* Enable the use of FastLED CRGB values directly to drawPixel.
* i.e. drawPixel(x, y, CRGB color)
*/
//#define FASTLED_CRGB_SUPPORT 1
/* Use GFX_Root (https://github.com/mrfaptastic/GFX_Root) instead of Adafruit_GFX library. /* Use GFX_Root (https://github.com/mrfaptastic/GFX_Root) instead of Adafruit_GFX library.
* > Removes Bus_IO & Wire.h library dependencies. * > Removes Bus_IO & Wire.h library dependencies.
* > Provides 24bpp (CRGB) color support for Adafruit_GFX functions like drawCircle etc. * > Provides 24bpp (CRGB) colour support for Adafruit_GFX functions like drawCircle etc.
* > Use this compile-time directive with FASTLED_CRGB_SUPPORT if 24bpp graphics * > Requires FastLED.h
* functions are needed.
*/ */
//#define USE_GFX_ROOT 1 //#define USE_GFX_ROOT 1
@ -102,14 +93,12 @@
#include "esp32_i2s_parallel_v2.h" #include "esp32_i2s_parallel_v2.h"
#ifdef USE_GFX_ROOT #ifdef USE_GFX_ROOT
#include "GFX.h" // Adafruit GFX core class -> https://github.com/mrfaptastic/GFX_Root #include <FastLED.h>
#include "GFX.h" // Adafruit GFX core class -> https://github.com/mrfaptastic/GFX_Root
#elif !defined NO_GFX #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 #endif
#ifdef FASTLED_CRGB_SUPPORT
#include <FastLED.h>
#endif
/***************************************************************************************/ /***************************************************************************************/
@ -455,10 +444,10 @@ class MatrixPanel_I2S_DMA {
void fillScreenRGB888(uint8_t r, uint8_t g, uint8_t b); 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); void drawPixelRGB888(int16_t x, int16_t y, uint8_t r, uint8_t g, uint8_t b);
#ifdef FASTLED_CRGB_SUPPORT #ifdef USE_GFX_ROOT
// 24bpp FASTLED CRGB colour struct support // 24bpp FASTLED CRGB colour struct support
void drawPixel(int16_t x, int16_t y, CRGB color);
void fillScreen(CRGB color); void fillScreen(CRGB color);
void drawPixel(int16_t x, int16_t y, CRGB color);
#endif #endif
void drawIcon (int *ico, int16_t x, int16_t y, int16_t cols, int16_t rows); void drawIcon (int *ico, int16_t x, int16_t y, int16_t cols, int16_t rows);
@ -720,7 +709,7 @@ inline void MatrixPanel_I2S_DMA::fillScreenRGB888(uint8_t r, uint8_t g,uint8_t b
updateMatrixDMABuffer(r, g, b); // RGB only (no pixel coordinate) version of 'updateMatrixDMABuffer' updateMatrixDMABuffer(r, g, b); // RGB only (no pixel coordinate) version of 'updateMatrixDMABuffer'
} }
#ifdef FASTLED_CRGB_SUPPORT #ifdef USE_GFX_ROOT
// Support for CRGB values provided via FastLED // Support for CRGB values provided via FastLED
inline void MatrixPanel_I2S_DMA::drawPixel(int16_t x, int16_t y, CRGB color) inline void MatrixPanel_I2S_DMA::drawPixel(int16_t x, int16_t y, CRGB color)
{ {

View file

@ -72,9 +72,9 @@ class VirtualMatrixPanel
void clearScreen() { void clearScreen() {
fillScreen(0); fillScreen(0);
} }
void drawPixelRGB565(int16_t x, int16_t y, uint16_t color); //void drawPixelRGB565(int16_t x, int16_t y, uint16_t color);
void drawPixelRGB888(int16_t x, int16_t y, 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);
void drawPixelRGB24(int16_t x, int16_t y, RGB24 color); //void drawPixelRGB24(int16_t x, int16_t y, RGB24 color);
void drawIcon (int *ico, int16_t x, int16_t y, int16_t module_cols, int16_t module_rows); void drawIcon (int *ico, int16_t x, int16_t y, int16_t module_cols, int16_t module_rows);
uint16_t color444(uint8_t r, uint8_t g, uint8_t b) { uint16_t color444(uint8_t r, uint8_t g, uint8_t b) {
@ -155,12 +155,13 @@ inline void VirtualMatrixPanel::fillScreen(uint16_t color) // adafruit virtual
// No need to map this. // No need to map this.
this->display->fillScreen(color); this->display->fillScreen(color);
} }
/*
inline void VirtualMatrixPanel::drawPixelRGB565(int16_t x, int16_t y, uint16_t color) inline void VirtualMatrixPanel::drawPixelRGB565(int16_t x, int16_t y, uint16_t color)
{ {
VirtualCoords coords = getCoords(x, y); VirtualCoords coords = getCoords(x, y);
this->display->drawPixelRGB565( coords.x, coords.y, color); this->display->drawPixelRGB565( coords.x, coords.y, color);
} }
*/
inline void VirtualMatrixPanel::drawPixelRGB888(int16_t x, int16_t y, uint8_t r, uint8_t g, uint8_t b) inline void VirtualMatrixPanel::drawPixelRGB888(int16_t x, int16_t y, uint8_t r, uint8_t g, uint8_t b)
@ -169,11 +170,13 @@ inline void VirtualMatrixPanel::drawPixelRGB888(int16_t x, int16_t y, uint8_t r,
this->display->drawPixelRGB888( coords.x, coords.y, r, g, b); this->display->drawPixelRGB888( coords.x, coords.y, r, g, b);
} }
/*
inline void VirtualMatrixPanel::drawPixelRGB24(int16_t x, int16_t y, RGB24 color) inline void VirtualMatrixPanel::drawPixelRGB24(int16_t x, int16_t y, RGB24 color)
{ {
VirtualCoords coords = getCoords(x, y); VirtualCoords coords = getCoords(x, y);
this->display->drawPixelRGB24(coords.x, coords.y, color); this->display->drawPixelRGB24(coords.x, coords.y, color);
} }
*/
#ifndef NO_GFX #ifndef NO_GFX
inline void VirtualMatrixPanel::drawDisplayTest() inline void VirtualMatrixPanel::drawDisplayTest()
@ -199,7 +202,8 @@ inline void VirtualMatrixPanel::drawIcon (int *ico, int16_t x, int16_t y, int16_
for (j = 0; j < module_cols; j++) { for (j = 0; j < module_cols; j++) {
// This is a call to this libraries version of drawPixel // This is a call to this libraries version of drawPixel
// which will map each pixel, which is what we want. // which will map each pixel, which is what we want.
drawPixelRGB565 (x + j, y + i, ico[i * module_cols + j]); //drawPixelRGB565 (x + j, y + i, ico[i * module_cols + j]);
drawPixel (x + j, y + i, ico[i * module_cols + j]);
} }
} }
} }