Dieselbe Display-Firmware bedient jetzt wahlweise das bisherige 4,3-Zoll-Panel JC4880P443C-I-W (ST7701, 480x800) oder das neue 7-Zoll-Panel JC1060P470C-I-W (JD9165, 1024x600). Umgeschaltet wird über JC_PANEL_TYPE in config.h (JC_PANEL_43 / JC_PANEL_70) oder per Compiler-Flag -DJC_PANEL_TYPE=70. Vorgabe bleibt das 4,3-Zoll-Panel; dessen Verhalten ändert sich nicht. - src/lcd/esp_lcd_jd9165.c/.h aus dem Hersteller-Paket übernommen; board_bringup.c legt je nach Panel DSI-Bus, DPI-Zeitbasis und Herstellertreiber an. - pins_config.h liefert Auflösung, LCD-Reset (4,3": GPIO5, 7,0": GPIO27) und Ausrichtung panelabhängig. Das 7-Zoll-Panel ist nativ Querformat, deshalb entfallen dort die 270-Grad-Rotation und die PPA-Beschleunigung. - lvgl_port_v9.h bezieht LVGL_PORT_H/V_RES aus pins_config.h statt fest 480/800. - Der GT911 des 7-Zöllers meldet Rohkoordinaten im Raster 800x480 statt 1024x600. Die Umrechnung hängt am process_coordinates-Hook von esp_lcd_touch, damit die Herstellerdatei esp_lcd_touch_gt911.c unverändert bleibt. - ui.cpp rechnet nicht mehr mit fest verdrahteten 480 Pixeln Höhe, sondern mit DISP_VER_RES. Layout und Schriften bleiben sonst unverändert. - Hersteller-Paket des 7-Zöllers unter JC_Display_Firmware_7zoll/ abgelegt; Werkzeuge, Archive und mitgelieferte Fremdbibliotheken per .gitignore ausgeschlossen (587 MB im Original, 21 MB im Repo). Kompiliertest ESP32-P4, beide Varianten: 4,3": 1.173.768 B Flash (37 %), 322.880 B RAM (98 %) 7,0": 1.138.752 B Flash (36 %), 322.600 B RAM (98 %) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
126 lines
4.8 KiB
C
126 lines
4.8 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include "soc/soc_caps.h"
|
|
|
|
#if SOC_MIPI_DSI_SUPPORTED
|
|
#include "esp_lcd_panel_vendor.h"
|
|
#include "esp_lcd_mipi_dsi.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief LCD panel initialization commands.
|
|
*
|
|
*/
|
|
typedef struct {
|
|
int cmd; /*<! The specific LCD command */
|
|
const void *data; /*<! Buffer that holds the command specific data */
|
|
size_t data_bytes; /*<! Size of `data` in memory, in bytes */
|
|
unsigned int delay_ms; /*<! Delay in milliseconds after this command */
|
|
} jd9165_lcd_init_cmd_t;
|
|
|
|
/**
|
|
* @brief LCD panel vendor configuration.
|
|
*
|
|
* @note This structure needs to be passed to the `vendor_config` field in `esp_lcd_panel_dev_config_t`.
|
|
*
|
|
*/
|
|
typedef struct {
|
|
const jd9165_lcd_init_cmd_t *init_cmds; /*!< Pointer to initialization commands array. Set to NULL if using default commands.
|
|
* The array should be declared as `static const` and positioned outside the function.
|
|
* Please refer to `vendor_specific_init_default` in source file.
|
|
*/
|
|
uint16_t init_cmds_size; /*<! Number of commands in above array */
|
|
struct {
|
|
esp_lcd_dsi_bus_handle_t dsi_bus; /*!< MIPI-DSI bus configuration */
|
|
const esp_lcd_dpi_panel_config_t *dpi_config; /*!< MIPI-DPI panel configuration */
|
|
} mipi_config;
|
|
} jd9165_vendor_config_t;
|
|
|
|
/**
|
|
* @brief Create LCD panel for model JD9165
|
|
*
|
|
* @note Vendor specific initialization can be different between manufacturers, should consult the LCD supplier for initialization sequence code.
|
|
*
|
|
* @param[in] io LCD panel IO handle
|
|
* @param[in] panel_dev_config General panel device configuration
|
|
* @param[out] ret_panel Returned LCD panel handle
|
|
* @return
|
|
* - ESP_ERR_INVALID_ARG if parameter is invalid
|
|
* - ESP_OK on success
|
|
* - Otherwise on fail
|
|
*/
|
|
esp_err_t esp_lcd_new_panel_jd9165(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config,
|
|
esp_lcd_panel_handle_t *ret_panel);
|
|
|
|
/**
|
|
* @brief MIPI-DSI bus configuration structure
|
|
*
|
|
* @param[in] lane_num Number of data lanes
|
|
* @param[in] lane_mbps Lane bit rate in Mbps
|
|
*
|
|
*/
|
|
#define JD9165_PANEL_BUS_DSI_2CH_CONFIG() \
|
|
{ \
|
|
.bus_id = 0, \
|
|
.num_data_lanes = 2, \
|
|
.phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT, \
|
|
.lane_bit_rate_mbps = 550, \
|
|
}
|
|
|
|
/**
|
|
* @brief MIPI-DBI panel IO configuration structure
|
|
*
|
|
*/
|
|
#define JD9165_PANEL_IO_DBI_CONFIG() \
|
|
{ \
|
|
.virtual_channel = 0, \
|
|
.lcd_cmd_bits = 8, \
|
|
.lcd_param_bits = 8, \
|
|
}
|
|
|
|
/**
|
|
* @brief MIPI DPI configuration structure
|
|
*
|
|
* @note refresh_rate = (dpi_clock_freq_mhz * 1000000) / (h_res + hsync_pulse_width + hsync_back_porch + hsync_front_porch)
|
|
* / (v_res + vsync_pulse_width + vsync_back_porch + vsync_front_porch)
|
|
*
|
|
* @param[in] px_format Pixel format of the panel
|
|
*
|
|
*/
|
|
#define JD9165_1024_600_PANEL_60HZ_DPI_CONFIG(px_format) \
|
|
{ \
|
|
.virtual_channel = 0, \
|
|
.dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT, \
|
|
.dpi_clock_freq_mhz = 56, \
|
|
.pixel_format = px_format, \
|
|
.num_fbs = 1, \
|
|
.video_timing = { \
|
|
.h_size = 1024, \
|
|
.v_size = 600, \
|
|
.hsync_pulse_width = 40, \
|
|
.hsync_back_porch = 160, \
|
|
.hsync_front_porch = 160, \
|
|
.vsync_pulse_width = 10, \
|
|
.vsync_back_porch = 23, \
|
|
.vsync_front_porch = 12, \
|
|
}, \
|
|
.flags= { \
|
|
.use_dma2d = true, \
|
|
}, \
|
|
}
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|