2020-11-28 09:39:35 +01:00
|
|
|
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
|
2019-01-12 18:20:49 +01:00
|
|
|
|
2021-02-16 21:20:09 +01:00
|
|
|
MatrixPanel_I2S_DMA *display = nullptr;
|
2019-01-12 18:20:49 +01:00
|
|
|
|
|
|
|
const byte row0 = 2+0*10;
|
|
|
|
const byte row1 = 2+1*10;
|
|
|
|
const byte row2 = 2+2*10;
|
|
|
|
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
|
|
|
|
// put your setup code here, to run once:
|
|
|
|
delay(1000); Serial.begin(115200); delay(200);
|
|
|
|
|
|
|
|
Serial.println("...Starting Display");
|
2020-08-14 11:21:31 +02:00
|
|
|
|
2021-02-16 21:20:09 +01:00
|
|
|
HUB75_I2S_CFG mxconfig;
|
|
|
|
mxconfig.double_buff = true; // Turn of double buffer
|
|
|
|
|
|
|
|
// OK, now we can create our matrix object
|
|
|
|
display = new MatrixPanel_I2S_DMA(mxconfig);
|
|
|
|
|
|
|
|
|
|
|
|
display->begin(); // setup display with pins as per defined in the library
|
|
|
|
display->setTextColor(display->color565(255, 255, 255));
|
2019-01-12 18:20:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
// Buffer 0 test
|
2021-02-16 21:20:09 +01:00
|
|
|
display->fillScreen(display->color565(128, 0, 0));
|
|
|
|
display->setCursor(3, row0);
|
|
|
|
display->print(F("Buffer 0"));
|
|
|
|
display->setCursor(3, row1);
|
|
|
|
display->print(F(" Buffer 0"));
|
2019-01-12 18:20:49 +01:00
|
|
|
Serial.println("Wrote to to Buffer 0");
|
2021-02-16 21:20:09 +01:00
|
|
|
display->showDMABuffer();
|
2019-01-12 18:20:49 +01:00
|
|
|
delay(1500);
|
|
|
|
|
|
|
|
// Buffer 1 test
|
2021-02-16 21:20:09 +01:00
|
|
|
display->flipDMABuffer();
|
|
|
|
display->fillScreen(display->color565(0, 128, 0)); // shouldn't see this
|
|
|
|
display->setCursor(3, row0);
|
|
|
|
display->print(F("Buffer 1"));
|
|
|
|
display->setCursor(3, row2);
|
|
|
|
display->print(F(" Buffer 1"));
|
2019-01-12 18:20:49 +01:00
|
|
|
|
|
|
|
Serial.println("Wrote to to Buffer 1");
|
2021-02-16 21:20:09 +01:00
|
|
|
display->showDMABuffer();
|
2019-01-12 18:20:49 +01:00
|
|
|
delay(1500);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
|
|
|
|
// Flip the back buffer
|
2021-02-16 21:20:09 +01:00
|
|
|
display->flipDMABuffer();
|
2019-01-12 18:20:49 +01:00
|
|
|
|
|
|
|
// Write: Set bottow row to black
|
|
|
|
for (int y=20;y<MATRIX_HEIGHT; y++)
|
|
|
|
for (int x=0;x<MATRIX_WIDTH; x++)
|
|
|
|
{
|
2021-02-16 21:20:09 +01:00
|
|
|
display->drawPixelRGB888( x, y, 0, 0, 0);
|
2019-01-12 18:20:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Write: Set bottom row to blue (this is what should show)
|
|
|
|
for (int y=20;y<MATRIX_HEIGHT; y++)
|
|
|
|
for (int x=0;x<MATRIX_WIDTH; x++)
|
|
|
|
{
|
2021-02-16 21:20:09 +01:00
|
|
|
display->drawPixelRGB888( x, y, 0, 0, 64);
|
2019-01-12 18:20:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Now show this back buffer
|
2021-02-16 21:20:09 +01:00
|
|
|
display->showDMABuffer();
|
2019-01-12 18:20:49 +01:00
|
|
|
delay(1000);
|
|
|
|
|
|
|
|
// Flip back buffer
|
2021-02-16 21:20:09 +01:00
|
|
|
display->flipDMABuffer();
|
2019-01-12 18:20:49 +01:00
|
|
|
|
|
|
|
// Show this buffer
|
2021-02-16 21:20:09 +01:00
|
|
|
display->showDMABuffer();
|
2019-01-12 18:22:13 +01:00
|
|
|
delay(1000);
|
2019-01-12 18:20:49 +01:00
|
|
|
|
2021-02-16 21:20:09 +01:00
|
|
|
}
|