matrix rain

This commit is contained in:
Felix Pankratz 2024-11-16 21:15:04 +01:00
parent 7ee5f339a2
commit 4c39671850
6 changed files with 370 additions and 0 deletions

4
nametag/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.pio
.clang_complete
.gcc-flags.json
.ccls

21
nametag/Makefile Normal file
View File

@ -0,0 +1,21 @@
# Uncomment lines below if you have problems with $PATH
#SHELL := /bin/bash
#PATH := /usr/local/bin:$(PATH)
all:
pio.exe -f -c vim run
upload:
pio.exe -f -c vim run --target upload
clean:
pio.exe -f -c vim run --target clean
program:
pio.exe -f -c vim run --target program
uploadfs:
pio.exe -f -c vim run --target uploadfs
update:
pio.exe -f -c vim update

22
nametag/platformio.ini Normal file
View File

@ -0,0 +1,22 @@
; 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:adafruit_matrixportal_esp32s3]
platform = espressif32
board = adafruit_matrixportal_esp32s3
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

View File

@ -0,0 +1,184 @@
const uint8_t CaveatBrush_Regular9pt7bBitmaps[] PROGMEM = {
0x00, 0x25, 0xB6, 0xDB, 0x6D, 0x81, 0xD8, 0xDE, 0xF5, 0x29, 0x48, 0x06,
0x40, 0x4E, 0x0C, 0xC0, 0xDF, 0x0F, 0xC7, 0xD8, 0xF1, 0xE1, 0xFE, 0xFF,
0x0F, 0x30, 0x23, 0x06, 0x20, 0x62, 0x00, 0x10, 0x47, 0xF7, 0xDF, 0x5F,
0x1E, 0x3C, 0xBA, 0xFF, 0x78, 0x82, 0x00, 0x60, 0x03, 0x80, 0x34, 0x01,
0xB1, 0x8D, 0x98, 0x68, 0x83, 0x4C, 0x0C, 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, 10, -1, -11 }, // 0x23 '#'
{ 31, 6, 15, 8, 1, -12 }, // 0x24 '$'
{ 43, 13, 14, 14, 1, -12 }, // 0x25 '%'
{ 66, 9, 13, 9, 0, -11 }, // 0x26 '&'
{ 81, 2, 6, 3, 1, -12 }, // 0x27 '''
{ 83, 5, 16, 5, 1, -13 }, // 0x28 '('
{ 93, 6, 14, 5, -1, -12 }, // 0x29 ')'
{ 104, 6, 6, 7, 0, -12 }, // 0x2A '*'
{ 109, 8, 8, 9, 1, -8 }, // 0x2B '+'
{ 117, 2, 5, 4, 1, -1 }, // 0x2C ','
{ 119, 6, 2, 7, 1, -4 }, // 0x2D '-'
{ 121, 2, 4, 4, 1, -2 }, // 0x2E '.'
{ 122, 6, 15, 5, 0, -11 }, // 0x2F '/'
{ 134, 8, 12, 8, 0, -11 }, // 0x30 '0'
{ 146, 6, 12, 6, 0, -11 }, // 0x31 '1'
{ 155, 7, 12, 7, 0, -11 }, // 0x32 '2'
{ 166, 7, 13, 8, 0, -11 }, // 0x33 '3'
{ 178, 9, 13, 8, 0, -11 }, // 0x34 '4'
{ 193, 8, 12, 8, 0, -11 }, // 0x35 '5'
{ 205, 8, 13, 8, 0, -11 }, // 0x36 '6'
{ 218, 7, 12, 7, 0, -11 }, // 0x37 '7'
{ 229, 8, 14, 8, 0, -12 }, // 0x38 '8'
{ 243, 8, 13, 8, 0, -11 }, // 0x39 '9'
{ 256, 2, 9, 4, 1, -7 }, // 0x3A ':'
{ 259, 2, 11, 4, 1, -7 }, // 0x3B ';'
{ 262, 7, 8, 9, 1, -8 }, // 0x3C '<'
{ 269, 7, 5, 7, 0, -5 }, // 0x3D '='
{ 274, 7, 8, 9, 1, -8 }, // 0x3E '>'
{ 281, 6, 14, 8, 1, -12 }, // 0x3F '?'
{ 292, 11, 14, 12, 0, -10 }, // 0x40 '@'
{ 312, 8, 12, 8, 0, -11 }, // 0x41 'A'
{ 324, 7, 13, 9, 1, -11 }, // 0x42 'B'
{ 336, 7, 13, 8, 1, -11 }, // 0x43 'C'
{ 348, 8, 13, 10, 1, -11 }, // 0x44 'D'
{ 361, 6, 13, 7, 1, -11 }, // 0x45 'E'
{ 371, 8, 13, 8, 1, -11 }, // 0x46 'F'
{ 384, 8, 13, 9, 1, -10 }, // 0x47 'G'
{ 397, 8, 12, 10, 1, -12 }, // 0x48 'H'
{ 409, 7, 13, 7, 0, -11 }, // 0x49 'I'
{ 421, 7, 13, 7, 0, -12 }, // 0x4A 'J'
{ 433, 8, 13, 9, 1, -11 }, // 0x4B 'K'
{ 446, 5, 12, 7, 1, -11 }, // 0x4C 'L'
{ 454, 10, 13, 12, 1, -11 }, // 0x4D 'M'
{ 471, 8, 12, 10, 1, -11 }, // 0x4E 'N'
{ 483, 7, 13, 9, 1, -11 }, // 0x4F 'O'
{ 495, 8, 14, 8, 0, -12 }, // 0x50 'P'
{ 509, 8, 14, 9, 1, -11 }, // 0x51 'Q'
{ 523, 8, 12, 9, 1, -11 }, // 0x52 'R'
{ 535, 7, 13, 8, 0, -11 }, // 0x53 'S'
{ 547, 9, 13, 9, 0, -12 }, // 0x54 'T'
{ 562, 8, 13, 9, 1, -11 }, // 0x55 'U'
{ 575, 9, 13, 9, 0, -12 }, // 0x56 'V'
{ 590, 10, 12, 12, 1, -10 }, // 0x57 'W'
{ 605, 9, 12, 9, 0, -12 }, // 0x58 'X'
{ 619, 8, 13, 8, 0, -11 }, // 0x59 'Y'
{ 632, 9, 13, 9, 0, -11 }, // 0x5A 'Z'
{ 647, 6, 17, 5, 1, -13 }, // 0x5B '['
{ 660, 6, 15, 5, 0, -11 }, // 0x5C '\'
{ 672, 6, 17, 5, -1, -12 }, // 0x5D ']'
{ 685, 6, 7, 9, 1, -12 }, // 0x5E '^'
{ 691, 10, 2, 12, 1, 2 }, // 0x5F '_'
{ 694, 4, 3, 6, 1, -12 }, // 0x60 '`'
{ 696, 7, 8, 8, 1, -7 }, // 0x61 'a'
{ 703, 6, 14, 8, 1, -12 }, // 0x62 'b'
{ 714, 5, 8, 6, 1, -7 }, // 0x63 'c'
{ 719, 6, 15, 8, 1, -12 }, // 0x64 'd'
{ 731, 5, 9, 7, 1, -7 }, // 0x65 'e'
{ 737, 7, 14, 6, 0, -12 }, // 0x66 'f'
{ 750, 5, 12, 7, 1, -7 }, // 0x67 'g'
{ 758, 6, 14, 8, 1, -12 }, // 0x68 'h'
{ 769, 2, 12, 4, 1, -11 }, // 0x69 'i'
{ 772, 6, 17, 4, -2, -11 }, // 0x6A 'j'
{ 785, 7, 13, 7, 1, -12 }, // 0x6B 'k'
{ 797, 3, 13, 4, 1, -11 }, // 0x6C 'l'
{ 802, 9, 8, 11, 1, -7 }, // 0x6D 'm'
{ 811, 7, 8, 8, 1, -7 }, // 0x6E 'n'
{ 818, 5, 8, 7, 1, -7 }, // 0x6F 'o'
{ 823, 6, 14, 8, 1, -8 }, // 0x70 'p'
{ 834, 7, 12, 8, 1, -7 }, // 0x71 'q'
{ 845, 5, 9, 6, 1, -7 }, // 0x72 'r'
{ 851, 5, 9, 6, 1, -7 }, // 0x73 's'
{ 857, 7, 13, 6, 0, -11 }, // 0x74 't'
{ 869, 6, 8, 8, 1, -7 }, // 0x75 'u'
{ 875, 6, 9, 7, 1, -7 }, // 0x76 'v'
{ 882, 8, 9, 9, 1, -7 }, // 0x77 'w'
{ 891, 7, 9, 7, 0, -7 }, // 0x78 'x'
{ 899, 5, 12, 7, 1, -7 }, // 0x79 'y'
{ 907, 7, 9, 7, 0, -7 }, // 0x7A 'z'
{ 915, 6, 18, 5, 0, -13 }, // 0x7B '{'
{ 929, 2, 15, 5, 1, -11 }, // 0x7C '|'
{ 933, 5, 17, 5, 0, -13 }, // 0x7D '}'
{ 944, 7, 3, 9, 1, -6 } }; // 0x7E '~'
const GFXfont CaveatBrush_Regular9pt7b PROGMEM = {
(uint8_t *)CaveatBrush_Regular9pt7bBitmaps,
(GFXglyph *)CaveatBrush_Regular9pt7bGlyphs,
0x20, 0x7E, 22 };
// Approx. 1619 bytes

129
nametag/src/main.cpp Normal file
View File

@ -0,0 +1,129 @@
#include <Arduino.h>
#include "xtensa/core-macros.h"
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
#include "main.h"
#include "caveatbrush9pt7b.h"
#define R1 42
#define G1 40
#define BL1 41
#define R2 38
#define G2 37
#define BL2 39
#define CH_A 45
#define CH_B 36
#define CH_C 48
#define CH_D 35
#define CH_E 21
#define CLK 2
#define LAT 47
#define OE 14
#define PIN_E 21
#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
#define ONBOARD_LED 13
MatrixPanel_I2S_DMA *matrix = nullptr;
uint16_t colorWheel(uint8_t pos) {
if(pos < 85) {
return matrix->color565(pos * 3, 255 - pos * 3, 0);
} else if(pos < 170) {
pos -= 85;
return matrix->color565(255 - pos * 3, 0, pos * 3);
} else {
pos -= 170;
return matrix->color565(0, pos * 3, 255 - pos * 3);
}
}
int line_pos[PANEL_WIDTH]; // where a rain marker is (y coordinate)
int line_length[PANEL_WIDTH]; // how long a line is for a given x coord
int line_speed[PANEL_WIDTH]; // how fast each line moves
void setup(){
Serial.begin(BAUD_RATE);
pinMode(ONBOARD_LED, OUTPUT);
for (int i = 0; i<PANEL_WIDTH; i++) {
line_pos[i] = 0 - random(32);
line_length[i] = random(5, 12);
line_speed[i] = random(10, 100);
}
// 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 = false;
matrix = new MatrixPanel_I2S_DMA(mxconfig);
matrix->begin();
matrix->setBrightness8(64);
matrix->fillScreenRGB888(0, 0, 0);
matrix->setFont(&CaveatBrush_Regular9pt7b);
}
uint8_t color = 0;
const char *str = "Panki";
void loop() {
matrix->fillScreenRGB888(0, 0, 0);
for (int x = 0; x < PANEL_WIDTH; x++) {
// step down a pixel
line_pos[x]++;
if (line_pos[x] > PANEL_HEIGHT) {
line_pos[x] = 0;
}
if (line_pos[x] >= 0) {
//draw our pixel
matrix->drawPixel(x, line_pos[x], matrix->color565(128, 255, 128));
// draw our trail
for (int trail_offset = 1; trail_offset < line_length[x]; trail_offset++) {
//if (random(10) > 8) {
// trail_offset++;
//}
int trail_y = line_pos[x] - trail_offset;
if (trail_y >= 0) {
matrix->drawPixel(x, trail_y, matrix->color565(0, (255 / line_length[x]) * (line_length[x] - trail_offset), 0));
} else {
if (line_pos[x] >= 0) {
matrix->drawPixel(x, PANEL_HEIGHT + trail_y, matrix->color565(0, 255 - (trail_offset * 16) , 0));
} else {
break;
}
}
}
}
}
delay(100);
//for (color=0; color<256; color++) {
// // create a border
// matrix->drawRect(0, 0, matrix->width(), matrix->height(), colorWheel(color));
// matrix->drawRect(1, 1, matrix->width()-2, matrix->height()-2, colorWheel(color));
// matrix->setTextSize(1);
// matrix->setTextWrap(false);
// matrix->setCursor(8, 22);
// //const char *str = "Panki";
// matrix->setTextColor(colorWheel(color+128));
// matrix->print(str);
// delay(100);
//}
}

10
nametag/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);