commit b7445338dbe436383891c8f3d40dfa5ed79851c6 Author: Felix Pankratz Date: Sun Nov 10 18:41:04 2024 +0100 pixel filling test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..16539a7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.pio diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 0000000..79c4140 --- /dev/null +++ b/platformio.ini @@ -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 + diff --git a/src/blink.cpp.bak b/src/blink.cpp.bak new file mode 100644 index 0000000..cde4b29 --- /dev/null +++ b/src/blink.cpp.bak @@ -0,0 +1,19 @@ +#include + +#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); +} diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..c32c4de --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,64 @@ +#include +#include "xtensa/core-macros.h" +#include + +#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); +} diff --git a/src/main.h b/src/main.h new file mode 100644 index 0000000..e4e784a --- /dev/null +++ b/src/main.h @@ -0,0 +1,10 @@ +#include + +#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); +