-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathcore_display.h
More file actions
52 lines (47 loc) · 2.38 KB
/
Copy pathcore_display.h
File metadata and controls
52 lines (47 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
// Vendored HUB75 driver (src/hub75/), not the Library Manager copy: it
// carries one addition, blitRGB888(), that upstream has no equivalent for.
// See src/hub75/VENDORED.md.
#include "hub75/ESP32-HUB75-MatrixPanel-I2S-DMA.h"
#include "config.h"
// 메인 .ino에서 생성할 디스플레이 객체를 모든 패턴에서 접근할 수 있게 열어둠
extern MatrixPanel_I2S_DMA *dma_display;
inline void initDisplay() {
HUB75_I2S_CFG::i2s_pins _pins = {
R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN,
PIN_A, PIN_B, PIN_C, PIN_D, PIN_E, LAT_PIN, OE_PIN, CLK_PIN
};
HUB75_I2S_CFG mxconfig(PANEL_RES_W, PANEL_RES_H, PANEL_CHAIN, _pins);
mxconfig.clkphase = false;
mxconfig.double_buff = true;
// Panel driver IC — see PANEL_PROFILE / HUB75_DRIVER in config.h.
mxconfig.driver = HUB75_DRIVER;
// Push panel refresh to ~240 Hz so phone-camera rolling shutter
// averages multiple cycles per exposure and the BCM bit-plane flicker
// stops showing up as visible bands on video. I2S/DMA refresh runs on
// hardware peripherals in parallel with the CPU, so this costs zero
// rendering FPS — the only trade is that the library may reduce
// effective color depth (8-bit → 6–7 bit) to hit the target rate,
// which can introduce mild banding in long smooth gradients. Dial
// min_refresh_rate down to ~180 if banding is noticeable.
//
// ⚠️ If an EMC radiated-emissions test fails: this 15 MHz clock and its
// harmonics, streamed continuously down the HUB75 ribbon, are the loudest
// thing in the product — far louder than Wi-Fi, which is a separate test
// entirely. HZ_10M drops the fundamental and every harmonic with it.
// It is NOT free: at a lower clock the library either sheds bit-planes to
// hold 240 Hz (banding in the gradients these patterns are made of) or
// keeps the depth and lets refresh fall (camera banding returns on video).
// Try the cheap fixes first — ferrite on the ribbon, shorter ribbon,
// routing, grounding — and come here only if a pre-scan says to.
mxconfig.i2sspeed = HUB75_I2S_CFG::HZ_15M;
mxconfig.min_refresh_rate = 240;
mxconfig.latch_blanking = 2;
dma_display = new MatrixPanel_I2S_DMA(mxconfig);
if (!dma_display->begin()) {
Serial.println("Matrix begin FAILED");
while (1) delay(1000);
}
dma_display->setBrightness8(DEFAULT_BRIGHTNESS);
dma_display->clearScreen();
}