65 lines
1.6 KiB
C++
65 lines
1.6 KiB
C++
#include <Arduino.h>
|
|
#include "xtensa/core-macros.h"
|
|
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
|
|
|
|
#include "main.h"
|
|
|
|
#define R1 25
|
|
#define G1 27 //26
|
|
#define BL1 26 //27
|
|
#define R2 14
|
|
#define G2 13 //12
|
|
#define BL2 12 //13
|
|
#define CH_A 23
|
|
#define CH_B 22 //19
|
|
#define CH_C 5
|
|
#define CH_D 17
|
|
#define CH_E 32 // assign to any available pin if using panels with 1/32 scan
|
|
#define CLK 16
|
|
#define LAT 4
|
|
#define OE 15
|
|
|
|
#define PIN_E 32
|
|
#define PANEL_WIDTH 64
|
|
#define PANEL_HEIGHT 32 // Panel height of 64 will required PIN_E to be defined.
|
|
|
|
#define PANELS_NUMBER 1
|
|
|
|
#define PANE_WIDTH PANEL_WIDTH * PANELS_NUMBER
|
|
#define PANE_HEIGHT PANEL_HEIGHT
|
|
#define NUM_LEDS PANE_WIDTH*PANE_HEIGHT
|
|
|
|
MatrixPanel_I2S_DMA *matrix = nullptr;
|
|
|
|
void setup(){
|
|
|
|
Serial.begin(BAUD_RATE);
|
|
Serial.println("Starting pattern test...");
|
|
|
|
// redefine pins if required
|
|
HUB75_I2S_CFG::i2s_pins _pins={R1, G1, BL1, R2, G2, BL2, CH_A, CH_B, CH_C, CH_D, CH_E, LAT, OE, CLK};
|
|
HUB75_I2S_CFG mxconfig(PANEL_WIDTH, PANEL_HEIGHT, PANELS_NUMBER, _pins);
|
|
|
|
mxconfig.gpio.e = PIN_E;
|
|
mxconfig.driver = HUB75_I2S_CFG::FM6126A; // for panels using FM6126A chips
|
|
|
|
mxconfig.latch_blanking = 4;
|
|
mxconfig.i2sspeed = HUB75_I2S_CFG::HZ_10M;
|
|
mxconfig.clkphase = true;
|
|
|
|
matrix = new MatrixPanel_I2S_DMA(mxconfig);
|
|
matrix->begin();
|
|
matrix->setBrightness8(32);
|
|
}
|
|
|
|
void loop() {
|
|
for(int y = 0; y!=PANE_HEIGHT; y++) {
|
|
for(int x = 0; x!=PANE_WIDTH; x++) {
|
|
matrix->drawPixelRGB888(x, y, 0, 0, 255);
|
|
delay(10);
|
|
}
|
|
Serial.printf("Row complete: %d\n", y);
|
|
}
|
|
matrix->fillScreenRGB888(0, 0, 0);
|
|
}
|