pixel filling test

This commit is contained in:
Felix Pankratz 2024-11-10 18:41:04 +01:00
commit b7445338db
5 changed files with 117 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.pio

23
platformio.ini Normal file
View File

@ -0,0 +1,23 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
adafruit/Adafruit GFX Library
adafruit/Adafruit BusIO
Wire
fastled/FastLED
https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA.git

19
src/blink.cpp.bak Normal file
View File

@ -0,0 +1,19 @@
#include <Arduino.h>
#define LED 2
void setup() {
// put your setup code here, to run once:
//Serial.begin(115200);
pinMode(LED, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED, HIGH);
//Serial.println("LED is on");
delay(1000);
digitalWrite(LED, LOW);
//Serial.println("LED is off");
delay(1000);
}

64
src/main.cpp Normal file
View File

@ -0,0 +1,64 @@
#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);
}

10
src/main.h Normal file
View File

@ -0,0 +1,10 @@
#include <FastLED.h>
#define BAUD_RATE 115200 // serial debug port baud rate
void buffclear(CRGB *buf);
uint16_t XY16( uint16_t x, uint16_t y);
void mxfill(CRGB *leds);
uint16_t colorWheel(uint8_t pos);
void drawText(int colorWheelOffset);