From 76a69e9f84d7fafd13784838c96e2e3110760bb2 Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Sat, 21 Jan 2023 18:17:20 +0000 Subject: Increase default speed --- .../4_HueValueSpectrumDemo.ino | 71 ++++++++++++++++++++++ .../HueValueSpectrumTestDemo.ino | 71 ---------------------- 2 files changed, 71 insertions(+), 71 deletions(-) create mode 100644 examples/4_HueValueSpectrumDemo/4_HueValueSpectrumDemo.ino delete mode 100644 examples/HueValueSpectrumTestDemo/HueValueSpectrumTestDemo.ino (limited to 'examples') diff --git a/examples/4_HueValueSpectrumDemo/4_HueValueSpectrumDemo.ino b/examples/4_HueValueSpectrumDemo/4_HueValueSpectrumDemo.ino new file mode 100644 index 0000000..3fcbb31 --- /dev/null +++ b/examples/4_HueValueSpectrumDemo/4_HueValueSpectrumDemo.ino @@ -0,0 +1,71 @@ +#define PANEL_RES_X 64 // Number of pixels wide of each INDIVIDUAL panel module. +#define PANEL_RES_Y 32 // Number of pixels tall of each INDIVIDUAL panel module. +#define PANEL_CHAIN 1 // Total number of panels chained one to another + +#define NO_CIE1931 +#define PIXEL_COLOUR_DEPTH_BITS 8 +#include + +MatrixPanel_I2S_DMA *dma_display = nullptr; + +#define R1_PIN 25 +#define G1_PIN 26 +#define B1_PIN 27 +#define R2_PIN 14 +#define G2_PIN 12 +#define B2_PIN 13 +#define A_PIN 23 +#define B_PIN 19 +#define C_PIN 5 +#define D_PIN 17 +#define E_PIN -1 // required for 1/32 scan panels, esp for 64x64 or 128x64 displays +#define LAT_PIN 4 +#define OE_PIN 15 +#define CLK_PIN 16 + +uint32_t lastMillis; + +void setup() { + HUB75_I2S_CFG::i2s_pins _pins={R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN, A_PIN, B_PIN, C_PIN, D_PIN, E_PIN, LAT_PIN, OE_PIN, CLK_PIN}; + HUB75_I2S_CFG mxconfig( + PANEL_RES_X, // Module width + PANEL_RES_Y, // Module height + 1, // chain length + _pins // pin mapping + ); + //mxconfig.gpio.e = 18; + //mxconfig.clkphase = false; + //mxconfig.driver = HUB75_I2S_CFG::FM6126A; + + // Display Setup + dma_display = new MatrixPanel_I2S_DMA(mxconfig); + dma_display->begin(); + dma_display->clearScreen(); +} + +void loop() { + // Canvas loop + float t = (float)(millis()%4000)/4000.f; + for(int x = 0; x < PANEL_RES_X; x++){ + float r =max(min(cosf(2.f*PI*(t+(float)x/PANEL_RES_X+0.f/3.f))+0.5f,1.f),0.f); + float g =max(min(cosf(2.f*PI*(t+(float)x/PANEL_RES_X+1.f/3.f))+0.5f,1.f),0.f); + float b =max(min(cosf(2.f*PI*(t+(float)x/PANEL_RES_X+2.f/3.f))+0.5f,1.f),0.f); + for(int y = 0; y < PANEL_RES_Y; y++) + if(y*2 < PANEL_RES_Y){ + float t = (2.f*y)/PANEL_RES_Y; + dma_display->drawPixelRGB888(x,y, + (r*t)*255, + (g*t)*255, + (b*t)*255 + ); + }else{ + float t = (2.f*(PANEL_RES_Y-y))/PANEL_RES_Y; + dma_display->drawPixelRGB888(x,y, + (r*t+1-t)*255, + (g*t+1-t)*255, + (b*t+1-t)*255 + ); + } + + } +} diff --git a/examples/HueValueSpectrumTestDemo/HueValueSpectrumTestDemo.ino b/examples/HueValueSpectrumTestDemo/HueValueSpectrumTestDemo.ino deleted file mode 100644 index 3fcbb31..0000000 --- a/examples/HueValueSpectrumTestDemo/HueValueSpectrumTestDemo.ino +++ /dev/null @@ -1,71 +0,0 @@ -#define PANEL_RES_X 64 // Number of pixels wide of each INDIVIDUAL panel module. -#define PANEL_RES_Y 32 // Number of pixels tall of each INDIVIDUAL panel module. -#define PANEL_CHAIN 1 // Total number of panels chained one to another - -#define NO_CIE1931 -#define PIXEL_COLOUR_DEPTH_BITS 8 -#include - -MatrixPanel_I2S_DMA *dma_display = nullptr; - -#define R1_PIN 25 -#define G1_PIN 26 -#define B1_PIN 27 -#define R2_PIN 14 -#define G2_PIN 12 -#define B2_PIN 13 -#define A_PIN 23 -#define B_PIN 19 -#define C_PIN 5 -#define D_PIN 17 -#define E_PIN -1 // required for 1/32 scan panels, esp for 64x64 or 128x64 displays -#define LAT_PIN 4 -#define OE_PIN 15 -#define CLK_PIN 16 - -uint32_t lastMillis; - -void setup() { - HUB75_I2S_CFG::i2s_pins _pins={R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN, A_PIN, B_PIN, C_PIN, D_PIN, E_PIN, LAT_PIN, OE_PIN, CLK_PIN}; - HUB75_I2S_CFG mxconfig( - PANEL_RES_X, // Module width - PANEL_RES_Y, // Module height - 1, // chain length - _pins // pin mapping - ); - //mxconfig.gpio.e = 18; - //mxconfig.clkphase = false; - //mxconfig.driver = HUB75_I2S_CFG::FM6126A; - - // Display Setup - dma_display = new MatrixPanel_I2S_DMA(mxconfig); - dma_display->begin(); - dma_display->clearScreen(); -} - -void loop() { - // Canvas loop - float t = (float)(millis()%4000)/4000.f; - for(int x = 0; x < PANEL_RES_X; x++){ - float r =max(min(cosf(2.f*PI*(t+(float)x/PANEL_RES_X+0.f/3.f))+0.5f,1.f),0.f); - float g =max(min(cosf(2.f*PI*(t+(float)x/PANEL_RES_X+1.f/3.f))+0.5f,1.f),0.f); - float b =max(min(cosf(2.f*PI*(t+(float)x/PANEL_RES_X+2.f/3.f))+0.5f,1.f),0.f); - for(int y = 0; y < PANEL_RES_Y; y++) - if(y*2 < PANEL_RES_Y){ - float t = (2.f*y)/PANEL_RES_Y; - dma_display->drawPixelRGB888(x,y, - (r*t)*255, - (g*t)*255, - (b*t)*255 - ); - }else{ - float t = (2.f*(PANEL_RES_Y-y))/PANEL_RES_Y; - dma_display->drawPixelRGB888(x,y, - (r*t+1-t)*255, - (g*t+1-t)*255, - (b*t+1-t)*255 - ); - } - - } -} -- cgit v1.3.1