Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
76da43a
added experimental spi transport
mkalkbrenner Dec 16, 2025
c9efdd8
send dmdreader signals
mkalkbrenner Dec 16, 2025
629eaa3
added pio
mkalkbrenner Dec 16, 2025
98e8a06
added color menu
mkalkbrenner Dec 17, 2025
0142f41
reduced the load of the irq handler
mkalkbrenner Dec 18, 2025
585b8f9
improved double buffering
mkalkbrenner Dec 18, 2025
e550ae1
switched to different lib
mkalkbrenner Dec 18, 2025
cfe1c03
fixed pico
mkalkbrenner Dec 18, 2025
7936482
Merge branch 'main' into lightweight_hub75
mkalkbrenner Dec 27, 2025
f9188bb
removed duplicate function
mkalkbrenner Dec 27, 2025
a367c03
removed function
mkalkbrenner Dec 27, 2025
cdb8423
Merge branch 'main' into lightweight_hub75
mkalkbrenner Dec 27, 2025
4c272c0
Merge branch 'main' into lightweight_hub75
mkalkbrenner Jan 25, 2026
b33a558
fixed compile issues
mkalkbrenner Jan 25, 2026
ff373b7
fixed build
mkalkbrenner Jan 25, 2026
a87b6f0
HUB75_MULTIPLEX_4_ROWS
mkalkbrenner Jan 25, 2026
f8585a7
changed setting
mkalkbrenner Jan 25, 2026
6a690aa
HUB75_P3_1415_16S_64X64_S31
mkalkbrenner Jan 25, 2026
c17f27c
HUB75_P10_3535_16X32_4S
mkalkbrenner Jan 25, 2026
878a3a5
new test
mkalkbrenner Jan 25, 2026
1b7b6a6
HUB75_P3_1415_16S_64X64_S31
mkalkbrenner Jan 25, 2026
de03b11
HUB75_P10_3535_16X32_4S
mkalkbrenner Jan 25, 2026
bcad99d
ROWSEL_N_PINS 5
mkalkbrenner Jan 25, 2026
c1a2c22
fixed builds
mkalkbrenner Jan 25, 2026
85d90c9
next test
mkalkbrenner Jan 26, 2026
235ca61
test
mkalkbrenner Jan 26, 2026
b592c54
test
mkalkbrenner Jan 26, 2026
2c7c7ad
1/16
mkalkbrenner Jan 26, 2026
0b4b982
inverted clock
mkalkbrenner Jan 26, 2026
34d0229
LATCH_BLANKING
mkalkbrenner Jan 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 36 additions & 32 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ board_build.arduino.earlephilhower.usb_pid = 0x1001
lib_deps =
thomasfredericks/Bounce2
https://github.com/Cpasjuste/Adafruit_TinyUSB_Arduino#zedmd
https://github.com/PPUC/pimoroni-pico#0002c1d20a8a6c79c6a4125fe34f12815b0e2f2c
https://github.com/PPUC/hub75#012944057476da4e4e976db7ed3b5fbc0bb4f2d2
lib_ignore =
SPI
WiFi
Expand Down Expand Up @@ -169,19 +169,29 @@ extends = pico
board = pico
build_flags = ${pico.build_flags}
-DZEDMD_HD=1
-DHUB75_MULTIPLEX_2_ROWS=1

[env:pico2_128x32]
extends = pico
board = rpipico2
build_flags = ${pico.build_flags}
-DBOARD_HAS_PSRAM
-DHUB75_MULTIPLEX_2_ROWS=1

[env:pico2_256x64]
extends = pico
board = rpipico2
build_flags = ${pico.build_flags}
-DBOARD_HAS_PSRAM
-DZEDMD_HD=1
-DZEDMD_HD_HALF=1
-DPICO_RP2350
-DDATA_BASE_PIN=0
-DROWSEL_BASE_PIN=6
-DROWSEL_N_PINS=5
-DCLK_PIN=11
-DSTROBE_PIN=12
-DOEN_PIN=13
-DLATCH_BLANKING=4

[env:pico2_128x32_ppucdmd]
extends = pico
Expand Down Expand Up @@ -210,23 +220,26 @@ extends = pico
board = rpipico2
build_flags = ${pico.build_flags}
-DBOARD_HAS_PSRAM
-DZEDMD_HD=1
-DZEDMD_HD_HALF=1
-DZEDMD_NO_NETWORKING=1
-DNO_PICO_GRAPHICS=1
-DDISPLAY_LED_MATRIX=1
-DMINIZ_NO_STDIO=1
-DMINIZ_NO_TIME=1
-DMINIZ_NO_DEFLATE_APIS=1
-DMINIZ_NO_ARCHIVE_APIS=1
-DMINIZ_NO_ZLIB_COMPATIBLE_NAMES=1
-Wl,-Map,${BUILD_DIR}/firmware.map
-Os
-DRP2350 ; needed for dmdreader
-DPICO_RP2350
-DPICO_RP2350A=0 ; Not RP2350A means RP2350B
-DHUB75_R0=30
-DHUB75_G0=31
-DHUB75_B0=32
-DHUB75_R1=33
-DHUB75_G1=34
-DHUB75_B1=35
-DHUB75_A=36
-DHUB75_B=37
-DHUB75_C=38
-DHUB75_D=39
-DHUB75_E=40
-DHUB75_CLK=41
-DHUB75_LAT=42
-DHUB75_OE=43
-DDATA_BASE_PIN=30
-DROWSEL_BASE_PIN=36
-DCLK_PIN=41
-DSTROBE_PIN=42
-DOEN_PIN=43
-DHUB75_LINEDECODER_SM5368

[ppucdmd]
platform = https://github.com/mkalkbrenner/platform-raspberrypi#issue-112
Expand All @@ -236,8 +249,8 @@ board_build.filesystem = littlefs
board_build.filesystem_size = 1.5m
lib_deps =
thomasfredericks/Bounce2
https://github.com/PPUC/pimoroni-pico#13f14db59efbabdbd51f0b4ab95269e18c7701ce
https://github.com/PPUC/dmdreader#c627fbe48d67f094e4a59ecbea8bc4319e97a6d0
https://github.com/PPUC/hub75#012944057476da4e4e976db7ed3b5fbc0bb4f2d2
lib_ignore =
WiFi
AsyncUDP
Expand All @@ -257,20 +270,11 @@ build_flags =
-DRP2350 ; needed for dmdreader
-DPICO_RP2350
-DPICO_RP2350A=0 ; Not RP2350A means RP2350B
-DHUB75_R0=30
-DHUB75_G0=31
-DHUB75_B0=32
-DHUB75_R1=33
-DHUB75_G1=34
-DHUB75_B1=35
-DHUB75_A=36
-DHUB75_B=37
-DHUB75_C=38
-DHUB75_D=39
-DHUB75_E=40
-DHUB75_CLK=41
-DHUB75_LAT=42
-DHUB75_OE=43
-DDATA_BASE_PIN=30
-DROWSEL_BASE_PIN=36
-DCLK_PIN=41
-DSTROBE_PIN=42
-DOEN_PIN=43
build_unflags = -Og

[env:ppucdmd_128x32]
Expand Down
58 changes: 18 additions & 40 deletions src/displays/PicoLedMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@

#include "pico/zedmd_pico.h"

static pimoroni::Hub75 *s_hub75;

// interrupt callback required function
static void __isr dma_complete() { s_hub75->dma_complete(); }

static uint8_t r5_to_8[32];
static uint8_t g6_to_8[64];
static uint8_t b5_to_8[32];
Expand All @@ -24,61 +19,44 @@ static void init_rgb_tables() {
}
}

static uint16_t lut_table[256] = {
0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 22, 23, 24, 26, 27,
29, 30, 32, 33, 35, 36, 38, 39, 41, 43, 44, 46, 48, 50, 51,
53, 55, 57, 59, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80,
82, 84, 87, 89, 91, 93, 95, 98, 100, 102, 104, 107, 109, 112, 114,
116, 119, 121, 124, 126, 129, 131, 134, 136, 139, 142, 144, 147, 150, 152,
155, 158, 161, 163, 166, 169, 172, 175, 178, 181, 184, 187, 190, 193, 196,
199, 202, 205, 208, 211, 214, 218, 221, 224, 227, 231, 234, 237, 241, 244,
248, 251, 254, 258, 262, 265, 269, 272, 276, 280, 283, 287, 291, 295, 298,
302, 306, 310, 314, 318, 322, 326, 330, 334, 338, 342, 346, 350, 354, 359,
363, 367, 372, 376, 380, 385, 389, 394, 398, 403, 407, 412, 416, 421, 426,
431, 435, 440, 445, 450, 455, 460, 465, 470, 475, 480, 485, 490, 495, 500,
506, 511, 516, 522, 527, 532, 538, 543, 549, 555, 560, 566, 572, 577, 583,
589, 595, 601, 607, 613, 619, 625, 631, 637, 643, 649, 656, 662, 668, 675,
681, 688, 694, 701, 708, 714, 721, 728, 735, 741, 748, 755, 762, 769, 776,
784, 791, 798, 805, 813, 820, 828, 835, 843, 850, 858, 866, 874, 881, 889,
897, 905, 913, 921, 929, 938, 946, 954, 963, 971, 980, 988, 997, 1005, 1014,
1023};

PicoLedMatrix::PicoLedMatrix() {
// rgb565 > rgb888 "fast" pixel conversion
init_rgb_tables();

s_hub75 = new pimoroni::Hub75(
TOTAL_WIDTH, PANEL_HEIGHT, nullptr, pimoroni::PANEL_FM6126A, false,
static_cast<pimoroni::Hub75::COLOR_ORDER>(color_order[rgbMode]),
lut_table);
s_hub75->start(dma_complete);
create_hub75_driver(TOTAL_WIDTH, PANEL_HEIGHT, PANEL_DP3246, false);
start_hub75_driver();
}

PicoLedMatrix::~PicoLedMatrix() {
s_hub75->stop(dma_complete);
delete s_hub75;
}
PicoLedMatrix::~PicoLedMatrix() {}

void IRAM_ATTR PicoLedMatrix::DrawPixel(const uint16_t x, const uint16_t y,
const uint8_t r, const uint8_t g,
const uint8_t b) {
s_hub75->set_pixel(x, y + yOffset, r, g, b);
uint16_t pos = ((y + yOffset) * TOTAL_WIDTH + x) * 3;
drawBuffer[pos] = b;
drawBuffer[++pos] = g;
drawBuffer[++pos] = r;
}

void IRAM_ATTR PicoLedMatrix::DrawPixel(const uint16_t x, const uint16_t y,
const uint16_t color) {
s_hub75->set_pixel(x, y + yOffset, r5_to_8[(color >> 11) & 0x1F],
g6_to_8[(color >> 5) & 0x3F], b5_to_8[color & 0x1F]);
uint16_t pos = ((y + yOffset) * TOTAL_WIDTH + x) * 3;
drawBuffer[pos] = r5_to_8[(color >> 11) & 0x1F];
drawBuffer[++pos] = g6_to_8[(color >> 5) & 0x3F];
drawBuffer[++pos] = b5_to_8[color & 0x1F];
}

void PicoLedMatrix::ClearScreen() { s_hub75->clear(); }
void PicoLedMatrix::ClearScreen() { memset(drawBuffer, 0, sizeof(drawBuffer)); }

void PicoLedMatrix::SetBrightness(const uint8_t level) {
// TODO: verify this (compare with an "esp board") ?
const auto b = static_cast<uint8_t>(static_cast<float>(level) * 1.5f);
s_hub75->brightness = b;
setBasisBrightness(b);
}

void PicoLedMatrix::Render() {
// double buffering is handled inside the hub75 driver
update_bgr(drawBuffer);
}

void PicoLedMatrix::Render() { s_hub75->render(); }
#endif // PICO_BUILD
19 changes: 11 additions & 8 deletions src/displays/PicoLedMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define PICO_LED_MATRIX_H

#include "LedMatrix.h"
#include "hub75.hpp"
#include <hub75.hpp>

class PicoLedMatrix final : public LedMatrix {
public:
Expand All @@ -18,13 +18,16 @@ class PicoLedMatrix final : public LedMatrix {
void Render() override;

private:
uint8_t color_order[6] = {
static_cast<uint8_t>(pimoroni::Hub75::COLOR_ORDER::RGB),
static_cast<uint8_t>(pimoroni::Hub75::COLOR_ORDER::BRG),
static_cast<uint8_t>(pimoroni::Hub75::COLOR_ORDER::GBR),
static_cast<uint8_t>(pimoroni::Hub75::COLOR_ORDER::RBG),
static_cast<uint8_t>(pimoroni::Hub75::COLOR_ORDER::GRB),
static_cast<uint8_t>(pimoroni::Hub75::COLOR_ORDER::BGR)};
/*
uint8_t color_order[6] = {
static_cast<uint8_t>(pimoroni::Hub75::COLOR_ORDER::RGB),
static_cast<uint8_t>(pimoroni::Hub75::COLOR_ORDER::BRG),
static_cast<uint8_t>(pimoroni::Hub75::COLOR_ORDER::GBR),
static_cast<uint8_t>(pimoroni::Hub75::COLOR_ORDER::RBG),
static_cast<uint8_t>(pimoroni::Hub75::COLOR_ORDER::GRB),
static_cast<uint8_t>(pimoroni::Hub75::COLOR_ORDER::BGR)};
*/
uint8_t drawBuffer[TOTAL_WIDTH * PANEL_HEIGHT * 3];
};

#endif // PICO_LED_MATRIX_H
5 changes: 3 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ void LoadUsbPackageSizeMultiplier() {
#ifdef ZEDMD_HD_HALF
void SaveYOffset() {
File f = LittleFS.open("/y_offset.val", "w");
f.write(yOffset);
f.write(static_cast<uint8_t>(yOffset));
f.close();
}

Expand All @@ -585,7 +585,7 @@ void LoadYOffset() {
SaveYOffset();
return;
}
yOffset = f.read();
yOffset = static_cast<int8_t>(f.read());
f.close();
}
#endif
Expand Down Expand Up @@ -2594,4 +2594,5 @@ void loop1() {
delay(1);
}
}

#endif