Update library class and name

This commit is contained in:
mrfaptastic 2020-11-28 09:45:30 +00:00
parent 5214d0540e
commit 460b823200
15 changed files with 42 additions and 38 deletions

View file

@ -64,7 +64,7 @@ uint8_t val2PWM(int val) {
return lumConvTab[val];
}
bool RGB64x32MatrixPanel_I2S_DMA::allocateDMAmemory()
bool MatrixPanel_I2S_DMA::allocateDMAmemory()
{
/***
@ -277,7 +277,7 @@ bool RGB64x32MatrixPanel_I2S_DMA::allocateDMAmemory()
void RGB64x32MatrixPanel_I2S_DMA::configureDMA(int r1_pin, int g1_pin, int b1_pin, int r2_pin, int g2_pin, int b2_pin, int a_pin, int b_pin, int c_pin, int d_pin, int e_pin, int lat_pin, int oe_pin, int clk_pin)
void MatrixPanel_I2S_DMA::configureDMA(int r1_pin, int g1_pin, int b1_pin, int r2_pin, int g2_pin, int b2_pin, int a_pin, int b_pin, int c_pin, int d_pin, int e_pin, int lat_pin, int oe_pin, int clk_pin)
{
#if SERIAL_DEBUG
Serial.println("configureDMA(): Starting configuration of DMA engine.\r\n");
@ -442,7 +442,7 @@ void RGB64x32MatrixPanel_I2S_DMA::configureDMA(int r1_pin, int g1_pin, int b1_
#ifdef GO_FOR_SPEED
/* Update a specific co-ordinate in the DMA buffer */
void RGB64x32MatrixPanel_I2S_DMA::updateMatrixDMABuffer(int16_t x_coord, int16_t y_coord, uint8_t red, uint8_t green, uint8_t blue)
void MatrixPanel_I2S_DMA::updateMatrixDMABuffer(int16_t x_coord, int16_t y_coord, uint8_t red, uint8_t green, uint8_t blue)
{
// Check that the co-ordinates are within range, or it'll break everything big time.
@ -512,7 +512,7 @@ void RGB64x32MatrixPanel_I2S_DMA::updateMatrixDMABuffer(int16_t x_coord, int16_t
/* Update a specific co-ordinate in the DMA buffer */
/* Original version were we re-create the bitstream from scratch for each x,y co-ordinate / pixel changed. Slightly slower. */
void RGB64x32MatrixPanel_I2S_DMA::updateMatrixDMABuffer(int16_t x_coord, int16_t y_coord, uint8_t red, uint8_t green, uint8_t blue)
void MatrixPanel_I2S_DMA::updateMatrixDMABuffer(int16_t x_coord, int16_t y_coord, uint8_t red, uint8_t green, uint8_t blue)
{
if ( !everything_OK ) {
@ -681,7 +681,7 @@ void RGB64x32MatrixPanel_I2S_DMA::updateMatrixDMABuffer(int16_t x_coord, int16_t
/* Update the entire buffer with a single specific colour - quicker */
void RGB64x32MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint8_t red, uint8_t green, uint8_t blue)
void MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint8_t red, uint8_t green, uint8_t blue)
{
if ( !everything_OK ) return;
@ -783,13 +783,13 @@ void RGB64x32MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint8_t red, uint8_t gre
* pre-init procedures for specific drivers
*
*/
void RGB64x32MatrixPanel_I2S_DMA::shiftDriver(const shift_driver _drv, const int dma_r1_pin, const int dma_g1_pin, const int dma_b1_pin, const int dma_r2_pin, const int dma_g2_pin, const int dma_b2_pin, const int dma_a_pin, const int dma_b_pin, const int dma_c_pin, const int dma_d_pin, const int dma_e_pin, const int dma_lat_pin, const int dma_oe_pin, const int dma_clk_pin){
void MatrixPanel_I2S_DMA::shiftDriver(const shift_driver _drv, const int dma_r1_pin, const int dma_g1_pin, const int dma_b1_pin, const int dma_r2_pin, const int dma_g2_pin, const int dma_b2_pin, const int dma_a_pin, const int dma_b_pin, const int dma_c_pin, const int dma_d_pin, const int dma_e_pin, const int dma_lat_pin, const int dma_oe_pin, const int dma_clk_pin){
switch (_drv){
case FM6124:
case FM6126A:
{
#if SERIAL_DEBUG
Serial.println( F("RGB64x32MatrixPanel_I2S_DMA - initializing FM6124 driver..."));
Serial.println( F("MatrixPanel_I2S_DMA - initializing FM6124 driver..."));
#endif
int C12[16] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
int C13[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0};

View file

@ -170,21 +170,21 @@ const uint16_t lumConvTab[]={
/***************************************************************************************/
#ifdef USE_GFX_ROOT
class RGB64x32MatrixPanel_I2S_DMA : public GFX {
class MatrixPanel_I2S_DMA : public GFX {
#else
class RGB64x32MatrixPanel_I2S_DMA : public Adafruit_GFX {
class MatrixPanel_I2S_DMA : public Adafruit_GFX {
#endif
// ------- PUBLIC -------
public:
/**
* RGB64x32MatrixPanel_I2S_DMA
* MatrixPanel_I2S_DMA
*
* @param {bool} _double_buffer : Double buffer is disabled by default. Enable only if you know what you're doing. Manual switching required with flipDMABuffer() and showDMABuffer()
*
*/
RGB64x32MatrixPanel_I2S_DMA(bool _double_buffer = false)
MatrixPanel_I2S_DMA(bool _double_buffer = false)
#ifdef USE_GFX_ROOT
: GFX(MATRIX_WIDTH, MATRIX_HEIGHT), double_buffering_enabled(_double_buffer) {
#else
@ -238,7 +238,7 @@ class RGB64x32MatrixPanel_I2S_DMA : public Adafruit_GFX {
#if SERIAL_DEBUG
if (!everything_OK)
Serial.println("RGB64x32MatrixPanel_I2S_DMA::begin() failed.");
Serial.println("MatrixPanel_I2S_DMA::begin() failed.");
#endif
return everything_OK;
@ -355,12 +355,12 @@ class RGB64x32MatrixPanel_I2S_DMA : public Adafruit_GFX {
/***************************************************************************************/
// https://stackoverflow.com/questions/5057021/why-are-c-inline-functions-in-the-header
/* 2. functions declared in the header must be marked inline because otherwise, every translation unit which includes the header will contain a definition of the function, and the linker will complain about multiple definitions (a violation of the One Definition Rule). The inline keyword suppresses this, allowing multiple translation units to contain (identical) definitions. */
inline void RGB64x32MatrixPanel_I2S_DMA::drawPixel(int16_t x, int16_t y, uint16_t color) // adafruit virtual void override
inline void MatrixPanel_I2S_DMA::drawPixel(int16_t x, int16_t y, uint16_t color) // adafruit virtual void override
{
drawPixelRGB565( x, y, color);
}
inline void RGB64x32MatrixPanel_I2S_DMA::fillScreen(uint16_t color) // adafruit virtual void override
inline void MatrixPanel_I2S_DMA::fillScreen(uint16_t color) // adafruit virtual void override
{
uint8_t r = ((((color >> 11) & 0x1F) * 527) + 23) >> 6;
uint8_t g = ((((color >> 5) & 0x3F) * 259) + 33) >> 6;
@ -369,13 +369,13 @@ inline void RGB64x32MatrixPanel_I2S_DMA::fillScreen(uint16_t color) // adafruit
updateMatrixDMABuffer(r, g, b); // the RGB only (no pixel coordinate) version of 'updateMatrixDMABuffer'
}
inline void RGB64x32MatrixPanel_I2S_DMA::fillScreenRGB888(uint8_t r, uint8_t g,uint8_t b) // adafruit virtual void override
inline void MatrixPanel_I2S_DMA::fillScreenRGB888(uint8_t r, uint8_t g,uint8_t b) // adafruit virtual void override
{
updateMatrixDMABuffer(r, g, b);
}
// For adafruit
inline void RGB64x32MatrixPanel_I2S_DMA::drawPixelRGB565(int16_t x, int16_t y, uint16_t color)
inline void MatrixPanel_I2S_DMA::drawPixelRGB565(int16_t x, int16_t y, uint16_t color)
{
uint8_t r = ((((color >> 11) & 0x1F) * 527) + 23) >> 6;
uint8_t g = ((((color >> 5) & 0x3F) * 259) + 33) >> 6;
@ -384,19 +384,19 @@ inline void RGB64x32MatrixPanel_I2S_DMA::drawPixelRGB565(int16_t x, int16_t y, u
updateMatrixDMABuffer( x, y, r, g, b);
}
inline void RGB64x32MatrixPanel_I2S_DMA::drawPixelRGB888(int16_t x, int16_t y, uint8_t r, uint8_t g,uint8_t b)
inline void MatrixPanel_I2S_DMA::drawPixelRGB888(int16_t x, int16_t y, uint8_t r, uint8_t g,uint8_t b)
{
updateMatrixDMABuffer( x, y, r, g, b);
}
inline void RGB64x32MatrixPanel_I2S_DMA::drawPixelRGB24(int16_t x, int16_t y, RGB24 color)
inline void MatrixPanel_I2S_DMA::drawPixelRGB24(int16_t x, int16_t y, RGB24 color)
{
updateMatrixDMABuffer( x, y, color.red, color.green, color.blue);
}
// Pass 8-bit (each) R,G,B, get back 16-bit packed color
//https://github.com/squix78/ILI9341Buffer/blob/master/ILI9341_SPI.cpp
inline uint16_t RGB64x32MatrixPanel_I2S_DMA::color565(uint8_t r, uint8_t g, uint8_t b) {
inline uint16_t MatrixPanel_I2S_DMA::color565(uint8_t r, uint8_t g, uint8_t b) {
/*
Serial.printf("Got r value of %d\n", r);
@ -408,14 +408,14 @@ inline uint16_t RGB64x32MatrixPanel_I2S_DMA::color565(uint8_t r, uint8_t g, uint
}
// Promote 3/3/3 RGB to Adafruit_GFX 5/6/5 RRRrrGGGgggBBBbb
inline uint16_t RGB64x32MatrixPanel_I2S_DMA::color333(uint8_t r, uint8_t g, uint8_t b) {
inline uint16_t MatrixPanel_I2S_DMA::color333(uint8_t r, uint8_t g, uint8_t b) {
return ((r & 0x7) << 13) | ((r & 0x6) << 10) | ((g & 0x7) << 8) | ((g & 0x7) << 5) | ((b & 0x7) << 2) | ((b & 0x6) >> 1);
}
inline void RGB64x32MatrixPanel_I2S_DMA::drawIcon (int *ico, int16_t x, int16_t y, int16_t cols, int16_t rows) {
inline void MatrixPanel_I2S_DMA::drawIcon (int *ico, int16_t x, int16_t y, int16_t cols, int16_t rows) {
/* drawIcon draws a C style bitmap.
// Example 10x5px bitmap of a yellow sun
//
@ -427,7 +427,7 @@ inline void RGB64x32MatrixPanel_I2S_DMA::drawIcon (int *ico, int16_t x, int16_t
0x0000, 0x0000, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0x0000, 0x0000,
};
RGB64x32MatrixPanel_I2S_DMA matrix;
MatrixPanel_I2S_DMA matrix;
matrix.drawIcon (half_sun, 0,0,10,5);
*/
@ -440,4 +440,7 @@ inline void RGB64x32MatrixPanel_I2S_DMA::drawIcon (int *ico, int16_t x, int16_t
}
}
/***************************************************************************************/
typedef MatrixPanel_I2S_DMA RGB64x32MatrixPanel_I2S_DMA; // for backwards compatibility to old class name
#endif

View file

@ -36,13 +36,13 @@ class VirtualMatrixPanel : public Adafruit_GFX
int16_t panelResX;
int16_t panelResY;
RGB64x32MatrixPanel_I2S_DMA *display;
MatrixPanel_I2S_DMA *display;
#ifdef USE_GFX_ROOT
VirtualMatrixPanel(RGB64x32MatrixPanel_I2S_DMA &disp, int vmodule_rows, int vmodule_cols, int panelX, int panelY, bool serpentine_chain = true, bool top_down_chain = false)
VirtualMatrixPanel(MatrixPanel_I2S_DMA &disp, int vmodule_rows, int vmodule_cols, int panelX, int panelY, bool serpentine_chain = true, bool top_down_chain = false)
: GFX(vmodule_cols*panelX, vmodule_rows*panelY)
#else
VirtualMatrixPanel(RGB64x32MatrixPanel_I2S_DMA &disp, int vmodule_rows, int vmodule_cols, int panelX, int panelY, bool serpentine_chain = true, bool top_down_chain = false )
VirtualMatrixPanel(MatrixPanel_I2S_DMA &disp, int vmodule_rows, int vmodule_cols, int panelX, int panelY, bool serpentine_chain = true, bool top_down_chain = false )
: Adafruit_GFX(vmodule_cols*panelX, vmodule_rows*panelY)
#endif
{

View file

@ -67,12 +67,12 @@ The panel must be powered by 5V AC adapter with enough current capacity. (Curren
# How to Use
Below is a bare minimum sketch to draw a single white dot in the top left. You must call .begin() before you call ANY pixel-drawing (fonts, lines, colours etc.) function of the RGB64x32MatrixPanel_I2S_DMA class.
Below is a bare minimum sketch to draw a single white dot in the top left. You must call .begin() before you call ANY pixel-drawing (fonts, lines, colours etc.) function of the MatrixPanel_I2S_DMA class.
No .begin() before other functions = Crash
```
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
RGB64x32MatrixPanel_I2S_DMA matrix;
MatrixPanel_I2S_DMA matrix;
void setup()
{

View file

@ -25,7 +25,7 @@
// ----------------------------
RGB64x32MatrixPanel_I2S_DMA dma_display;
MatrixPanel_I2S_DMA dma_display;
AnimatedGIF gif;
File f;
int x_offset, y_offset;

View file

@ -21,7 +21,7 @@
/* -------------------------- Class Initialisation -------------------------- */
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
RGB64x32MatrixPanel_I2S_DMA matrix;
MatrixPanel_I2S_DMA matrix;
#include <FastLED.h>

View file

@ -28,7 +28,7 @@
// Display
RGB64x32MatrixPanel_I2S_DMA display; // RGB Panel
MatrixPanel_I2S_DMA display; // RGB Panel
// Wifi Logo, generated using LCD Image Converter: http://www.riuson.com/lcd-image-converter
const char wifi_image1bit[] PROGMEM = {

View file

@ -171,7 +171,7 @@
* Create physical DMA panel class AND virtual (chained) display class.
******************************************************************************/
#include <ESP32-VirtualMatrixPanel-I2S-DMA.h>
RGB64x32MatrixPanel_I2S_DMA dma_display;
MatrixPanel_I2S_DMA dma_display;
VirtualMatrixPanel virtualDisp(dma_display, NUM_ROWS, NUM_COLS, PANEL_RES_X, PANEL_RES_Y, true);

View file

@ -47,10 +47,10 @@ int lastPattern = 0;
/* -------------------------- Class Initialisation -------------------------- */
//#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
//RGB64x32MatrixPanel_I2S_DMA matrix;
//MatrixPanel_I2S_DMA matrix;
#include <ESP32-VirtualMatrixPanel-I2S-DMA.h>
RGB64x32MatrixPanel_I2S_DMA matrix;
MatrixPanel_I2S_DMA matrix;
// Added support for 'Chained' virtual panel configurations.
VirtualMatrixPanel virtualDisp(matrix, NUM_ROWS, NUM_COLS, PANEL_RES_X, PANEL_RES_Y, true);

View file

@ -1,6 +1,6 @@
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
RGB64x32MatrixPanel_I2S_DMA display(true); // Note the TRUE -> Turns of secondary buffer - "double buffering"!
MatrixPanel_I2S_DMA display(true); // Note the TRUE -> Turns of secondary buffer - "double buffering"!
// Double buffering is not enabled by default with the library.
const byte row0 = 2+0*10;

View file

@ -4,7 +4,7 @@
#include <Arduino.h>
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
RGB64x32MatrixPanel_I2S_DMA dma_display;
MatrixPanel_I2S_DMA dma_display;
#include <FastLED.h>

View file

@ -1,6 +1,6 @@
/* -------------------------- Class Initialisation -------------------------- */
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
RGB64x32MatrixPanel_I2S_DMA matrix;
MatrixPanel_I2S_DMA matrix;
#include "TPM2.h" // https://github.com/rstephan/TPM2

View file

@ -44,7 +44,7 @@
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
RGB64x32MatrixPanel_I2S_DMA dma_display;
MatrixPanel_I2S_DMA dma_display;
#include <FastLED.h>

View file

@ -1,5 +1,5 @@
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
RGB64x32MatrixPanel_I2S_DMA dma_display;
MatrixPanel_I2S_DMA dma_display;
// Or use an Alternative non-DMA library, i.e:
//#include <P3RGB64x32MatrixPanel.h>

View file

@ -1,4 +1,5 @@
RGB64x32MatrixPanel_I2S_DMA KEYWORD1
MatrixPanel_I2S_DMA KEYWORD1
fillScreen KEYWORD2
clearScreen KEYWORD2
fillScreenRGB888 KEYWORD2