/* * Display Initialization Module * * Handles hardware-specific initialization for the Waveshare ESP32-S3-Touch-LCD-5B: * - Board initialization (LCD panel, touch controller) * - LVGL initialization and configuration * - SquareLine Studio UI loading * - Backlight control to prevent white flash during startup */ #pragma once #include #include using namespace esp_panel::drivers; using namespace esp_panel::board; namespace DisplayInit { /** * @brief Display hardware objects returned by initialization */ struct DisplayObjects { Board* board; // ESP32 Display Panel board object Backlight* backlight; // Backlight controller }; /** * @brief Initialize the display hardware and LVGL * * This function performs the complete display initialization sequence: * 1. Create and initialize the display board object * 2. Configure framebuffers (if avoid-tearing mode is enabled) * 3. Initialize backlight (off initially to prevent white flash) * 4. Start the board * 5. Initialize LVGL porting layer * 6. Load SquareLine Studio UI * 7. Turn on backlight after UI is ready * * @return DisplayObjects containing board and backlight pointers * @note This function will halt in an infinite loop if board initialization fails */ DisplayObjects init(); /** Backlight on/off after init() (e.g. dark during OTA flash writes, which flicker the panel). */ void setBacklight(bool on); } // namespace DisplayInit