From 965f88596f8c1272a8c60f2aa0fd2a5ab88c9025 Mon Sep 17 00:00:00 2001 From: Luke Hoersten Date: Sat, 13 Jun 2026 22:35:21 -0500 Subject: M3: display driver (Pi-style DSI panel: TC358762 + ATTINY MCU) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit display.{h,c} brings up the Hosyond 5\" 800x480 panel via the Raspberry Pi 7\" touchscreen architecture: - I2C init to the panel-side MCU at 0x45 (Pi 7\" register map ported from drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c). - POWERON write + 120ms settle. - ESP32-P4 MIPI-DSI bring-up in DPI video mode: 2-lane, 480 Mbps, 800x480 @ 60Hz, RGB565, canonical Pi 7\" timings (HSW=18/HBP=20/HFP=62, VSW=4/VBP=27/VFP=18, 30 MHz pixel clock). - Gamma-corrected (^2.2) PWM brightness via REG_PWM (0x86). - display_sleep / display_wake hooks for M6. - display_fill() and display_test_pattern() (8 vertical color bars) for M3 acceptance and reuse by M8 local screens. app_main calls display_init() as best-effort — if the panel isn't attached or wiring is wrong, the rest of the firmware (Ethernet, mDNS, /state) keeps running. On success it paints the test pattern. Pin assignments (PIN_I2C_SDA=7, PIN_I2C_SCL=8) match Waveshare's bundled-panel BSP convention but are flagged TODO until the user's specific FPC adapter wiring is confirmed. main/CMakeLists.txt: add driver, esp_driver_i2c, esp_lcd to REQUIRES. Build verified clean against ESP-IDF 5.4 for target esp32p4. M3 acceptance (color bars on screen) cannot be verified without a flashed board + connected panel. --- main/display.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 main/display.h (limited to 'main/display.h') diff --git a/main/display.h b/main/display.h new file mode 100644 index 0000000..58e71b7 --- /dev/null +++ b/main/display.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include + +#include "esp_err.h" + +// Initialize the panel-side MCU over I2C, then bring up the DSI link in +// video (DPI) mode. Safe to call when the panel is not attached — returns +// an error and lets the rest of the firmware keep running. +esp_err_t display_init(void); + +bool display_is_up(void); + +// 0–100, gamma-corrected to 0–255 on the panel-MCU PWM register. +// brightness=0 is fully off (backlight enable line de-asserted). +esp_err_t display_set_brightness(uint8_t brightness_0_100); + +// Sleep / wake hooks for the wake/sleep state machine (M6). +// Sleep cuts backlight; wake restores last brightness. +esp_err_t display_sleep(void); +esp_err_t display_wake(void); + +// Paint a solid RGB565 color to the entire framebuffer + flush. +// Used by M3 for the test pattern and by local_screens for the IP and +// loading screens (M8). +esp_err_t display_fill(uint16_t rgb565); + +// Show a deterministic test pattern (vertical color bars). M3 acceptance. +esp_err_t display_test_pattern(void); -- cgit v1.2.3