DEKI/ENGINE 文档
deki-lovyangfx-integration 0.19.0
Deki 包参考
deki-lovyangfx-integration

通过 LovyanGFX 1.2.19 实现嵌入式显示和触摸。驱动常见的 SPI/并口 TFT 屏和 FT6336U 电容触摸面板。

仓库:github.com/dekiengine/deki-lovyangfx-integration · 最新版本:0.19.0 · 需要引擎 0.19.0 或更高版本 · 依赖:deki-i2c, deki-input

使用 DekiEditor --packages-add deki-lovyangfx-integration <project> 或通过包管理器安装。引擎自身的组件和 C++ API 见 Deki 文档。

在编辑器中显示为 **LovyanGFX Integration**。

组件

组件 类别 说明
LGFXDisplayPanel LovyanGFX 通过 LovyanGFX,经由 SPI、QSPI 或并行总线驱动显示面板(ILI9341、ST7789、GC9A01、RM67162 AMOLED 等)。
LGFXTouchPanel LovyanGFX 通过 LovyanGFX 读取触摸控制器(FT5x06、GT911、CST816S、XPT2046)。

功能开关

可以从构建中去掉的部分。带有 define 的功能通过该 define 开关,其余的随其组件一起被剥离。

功能 define 默认值
Display Panel DEKI_FEATURE_LGFX_DISPLAY_PANEL 开
Touch Panel DEKI_FEATURE_LGFX_TOUCH_PANEL 开

组件参考

LGFXDisplayPanel

通过 LovyanGFX,经由 SPI、QSPI 或并行总线驱动显示面板(ILI9341、ST7789、GC9A01、RM67162 AMOLED 等)。

检视器中的名称:LGFX 显示面板 · 类别:LovyanGFX · 类型:DekiLovyanGfx::LGFXDisplayPanel

属性 类型 默认值 约束 说明
panelType enum "ILI9341" ILI9341, ST7789, ST7735, GC9A01, SSD1351, ST7789P3, RM67162 显示面板驱动 IC
panelWidth int32 320 1 到 1024 显示屏宽度(像素)
panelHeight int32 240 1 到 1024 显示屏高度(像素)
rotation enum "Landscape" Portrait, Landscape, Portrait180, Landscape270, PortraitMirror, LandscapeMirror, Portrait180Mirror, Landscape270Mirror 显示屏旋转
offsetX int32 0 像素偏移 X(用于原点不为 0 的面板)
offsetY int32 0 像素偏移 Y(用于原点不为 0 的面板)
invertColor bool false 反转显示屏颜色
rgbOrder bool false 交换 R 和 B 颜色通道(RGB 与 BGR)
busType enum "Parallel8bit" SPI, Parallel8bit, Parallel16bit, QSPI 显示屏总线类型
mosiPin int32 -1 -1 到 48;busType 允许时显示 SPI MOSI 引脚
misoPin int32 -1 -1 到 48;busType 允许时显示 SPI MISO 引脚(-1 = 不使用)
clkPin int32 -1 -1 到 48;busType 允许时显示 SPI 时钟引脚
dcPin int32 -1 -1 到 48;busType 允许时显示 SPI 数据/命令引脚
spiPort int32 0 0 到 2;busType 允许时显示 SPI 主机,按 ESP-IDF 的编号(在 ESP32-S3 上:1 = SPI2,2 = SPI3)
spiWriteHz int32 40000000 busType 允许时显示 SPI 写入频率 (Hz)
io0Pin int32 -1 -1 到 48;busType 允许时显示 QSPI 数据引脚 IO0
io1Pin int32 -1 -1 到 48;busType 允许时显示 QSPI 数据引脚 IO1
io2Pin int32 -1 -1 到 48;busType 允许时显示 QSPI 数据引脚 IO2
io3Pin int32 -1 -1 到 48;busType 允许时显示 QSPI 数据引脚 IO3
parWriteHz int32 40000000 busType 允许时显示 并行总线写入频率 (Hz)
rsPin int32 -1 -1 到 48;busType 允许时显示 寄存器选择 / 数据-命令引脚 (RS/DC)
wrPin int32 -1 -1 到 48;busType 允许时显示 并行总线写选通引脚
rdPin int32 -1 -1 到 48;busType 允许时显示 并行总线读选通引脚(-1 = 不使用)
d0Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D0
d1Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D1
d2Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D2
d3Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D3
d4Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D4
d5Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D5
d6Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D6
d7Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D7
d8Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D8
d9Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D9
d10Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D10
d11Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D11
d12Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D12
d13Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D13
d14Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D14
d15Pin int32 -1 -1 到 48;busType 允许时显示 并行数据引脚 D15
csPin int32 -1 -1 到 48 片选引脚(-1 = 不使用)
rstPin int32 -1 -1 到 48 复位引脚(-1 = 未连接)
blPin int32 -1 -1 到 48 背光引脚(-1 = 无)
blPwmChannel int32 0 0 到 15 背光的 PWM 通道
blInvert bool false 反转背光信号(低电平有效)
blBrightness int32 255 0 到 255 启动时的背光亮度,0-255(PWM 占空比)。255 时引脚保持高电平。靠计数脉冲调光的背光驱动(如 LilyGO T-Deck 上的)需要设为 255:PWM 波形会让它在各亮度级别间不断切换,导致闪烁
swapBytes bool false 向显示屏传输时交换 RGB565 的字节顺序
memoryWidth int32 320 1 到 1024 面板显存宽度(可能与可见宽度不同)
memoryHeight int32 240 1 到 1024 面板显存高度(可能与可见高度不同)
usePsram bool false 将帧缓冲放在 PSRAM 而不是内部 RAM 中:可腾出一屏大小的内部 RAM,但绘制会变慢
doubleBuffer bool false 为异步 DMA 使用双缓冲(渲染与显示屏传输同时进行)
asyncPresent bool false 在绘制下一帧的同时,由芯片的另一个核心发送当前帧:每帧耗时为绘制和发送中较长的一项,而不是两者之和。需要两帧大小的外部内存 (PSRAM) 和双核芯片;适用于呈现整帧、需要交换字节 (swapBytes) 的面板。

LGFXTouchPanel

通过 LovyanGFX 读取触摸控制器(FT5x06、GT911、CST816S、XPT2046)。

检视器中的名称:LGFX 触摸面板 · 类别:LovyanGFX · 类型:DekiLovyanGfx::LGFXTouchPanel

属性 类型 默认值 约束 说明
driverType enum "FT5x06" FT5x06, GT911, CST816S, XPT2046 触摸控制器 IC
i2cPort int32 0 0 到 3;driverType 允许时显示 I2C 总线端口(必须与启动场景中的 I2C 总线组件一致)
csPin int32 -1 -1 到 48;driverType 允许时显示 SPI 片选引脚(-1 = 不使用)
mosiPin int32 -1 -1 到 48;driverType 允许时显示 SPI MOSI 引脚(-1 = 不使用)
misoPin int32 -1 -1 到 48;driverType 允许时显示 SPI MISO 引脚(-1 = 不使用)
clkPin int32 -1 -1 到 48;driverType 允许时显示 SPI 时钟引脚(-1 = 不使用)
intPin int32 -1 -1 到 48 触摸事件的中断引脚(-1 = 轮询模式)
rstPin int32 -1 -1 到 48 触摸控制器的复位引脚(-1 = 未连接)
xMin int32 0 触摸控制器报告的原始 X 最小值,沿显示屏旋转前的面板宽度方向
xMax int32 239 触摸控制器报告的原始 X 最大值,沿显示屏旋转前的面板宽度方向(240x320 面板横向显示时:239)
yMin int32 0 触摸控制器报告的原始 Y 最小值,沿显示屏旋转前的面板高度方向
yMax int32 319 触摸控制器报告的原始 Y 最大值,沿显示屏旋转前的面板高度方向(240x320 面板横向显示时:319)
offsetRotation enum "None" None, CW_90, CW_180, CW_270, Mirror, Mirror_CW_90, Mirror_CW_180, Mirror_CW_270 触摸控制器相对面板的旋转方向,会叠加到显示屏旋转上。控制器按面板自身方向报告坐标时选择“无”
busShared bool false 触摸与显示屏共用 SPI 总线时启用

更新日志

更新日志为英文。

0.19.0

Changed

  • minEngine 0.19.0: built against engine 0.19.0, whose component metadata records the package each class is in. A build of this package from before does not load and is rebuilt.

Added

  • Japanese, Simplified Chinese and Korean: editor/lang/ja.json, zh.json and ko.json translate the names, tooltips and enum values this package's components show in the Inspector.

0.18.2

Added

  • asyncPresent on the display panel: a frame is sent from the other core while the next is drawn, through two staging buffers in PSRAM. Drawing and sending each fit in a 60 Hz frame on a LilyGO T-Deck, one after the other they did not. On ESP32 with two cores; off by default.

Changed

  • A frame goes to the panel by DMA, in bands within one transaction: each band is converted while the one before is being sent. Each band used to be fed to the SPI FIFO by the CPU and waited for before the next was converted, the conversion and the transfer one after the other.

Fixed

  • An I2C touch panel no longer shares the display's bus. Shared, each touch read ended the display's SPI transaction, which broke a frame being sent from the other core.
  • The backlight starts at full brightness (blBrightness, 255 by default), as it is after waking from sleep. It started at LovyanGFX's 127, a 1.2 kHz PWM wave, and a backlight driver that dims by counting pulses, as the LilyGO T-Deck's does, read every cycle of it as a step down and flickered.
  • The touch panel's bounds group was labelled "Touch Panel DekiParticles::Bounds". The bounds' tooltips say they run along the panel before the display is rotated, and offsetRotation's that it is added to the display rotation (it is not the display rotation).

更早的版本:CHANGELOG.md


由包的反射数据生成(引擎 0.19.0)。属性名就是场景文件中使用的键。重命名后会保留别名(兼容性)。