diff options
| author | mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> | 2021-02-15 15:36:20 +0000 |
|---|---|---|
| committer | mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> | 2021-02-15 15:36:20 +0000 |
| commit | 3214cd643d93a212247bae92e4e9ac4ed20e02e3 (patch) | |
| tree | e4ddbe968dd8b05960e2e5589e93f51b3d40f6b5 /examples | |
| parent | 58abc5f2fb3481faeffc0f69bd4cc7f66ebfe3d6 (diff) | |
Minor changes
* Fix double buffer example
* Remove the I2S user clock config for simplicity - ESP32 turns out to be massively limited anyway to 20Mhz...
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/DoubleBufferSwap/DoubleBufferSwap.ino | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/examples/DoubleBufferSwap/DoubleBufferSwap.ino b/examples/DoubleBufferSwap/DoubleBufferSwap.ino index 81e116d..76e2ea2 100644 --- a/examples/DoubleBufferSwap/DoubleBufferSwap.ino +++ b/examples/DoubleBufferSwap/DoubleBufferSwap.ino @@ -10,8 +10,8 @@ * for different resolutions / panel chain lengths within the sketch 'setup()'. * */ -MatrixPanel_I2S_DMA display(true); // Note the TRUE -> Turns of secondary buffer - "double buffering"! - // Double buffering is not enabled by default with the library. + +MatrixPanel_I2S_DMA *display = nullptr; const byte row0 = 2+0*10; const byte row1 = 2+1*10; @@ -26,30 +26,37 @@ void setup() Serial.println("...Starting Display"); - display.begin(); // setup display with pins as per defined in the library - display.setTextColor(display.color565(128, 128, 128)); + 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)); // Buffer 0 test - 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")); + 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")); Serial.println("Wrote to to Buffer 0"); - display.showDMABuffer(); + display->showDMABuffer(); delay(1500); // Buffer 1 test - 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")); + 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")); Serial.println("Wrote to to Buffer 1"); - display.showDMABuffer(); + display->showDMABuffer(); delay(1500); } @@ -57,31 +64,31 @@ void setup() void loop() { // Flip the back buffer - display.flipDMABuffer(); + display->flipDMABuffer(); // Write: Set bottow row to black for (int y=20;y<MATRIX_HEIGHT; y++) for (int x=0;x<MATRIX_WIDTH; x++) { - display.drawPixelRGB888( x, y, 0, 0, 0); + display->drawPixelRGB888( x, y, 0, 0, 0); } // 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++) { - display.drawPixelRGB888( x, y, 0, 0, 64); + display->drawPixelRGB888( x, y, 0, 0, 64); } // Now show this back buffer - display.showDMABuffer(); + display->showDMABuffer(); delay(1000); // Flip back buffer - display.flipDMABuffer(); + display->flipDMABuffer(); // Show this buffer - display.showDMABuffer(); + display->showDMABuffer(); delay(1000); -} +}
\ No newline at end of file |
