LCD Unit

Unit LCD 为 1.14 英寸彩色 LCD 扩展屏单元。采用 ST7789V2 驱动方案,分辨率为 135*240,支持 RGB666 显示(262144 种颜色)。内部集成 ESP32-PICO 控制核心(内置固件,显示开发更便捷),支持通过 I2C(addr:0x3E)通信接口进行控制和固件升级。屏幕背面采用一体化磁吸设计,可轻松吸附在金属表面进行固定。该 LCD 屏扩展适合嵌入到各类需要作为显示面板显示简单内容的仪器或控制设备中。

支持以下产品:

LCDUnit

UiFlow2 应用示例

绘制文本

在 UiFlow2 中打开 cores3_lcd_example.m5f2 项目。

此示例在屏幕上显示文本“LCD”。

UiFlow2 代码块:

example.png

示例输出:

None

MicroPython 应用示例

绘制文本

此示例在屏幕上显示文本“LCD”。

MicroPython 代码块:

 1# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
 2#
 3# SPDX-License-Identifier: MIT
 4
 5import os, sys, io
 6import M5
 7from M5 import *
 8from hardware import I2C
 9from hardware import Pin
10from unit import LCDUnit
11
12
13label0 = None
14label1 = None
15i2c0 = None
16lcd_0 = None
17
18
19def setup():
20    global label0, label1, i2c0, lcd_0
21
22    M5.begin()
23    Widgets.fillScreen(0x222222)
24    label0 = Widgets.Label("CoreS3", 127, 109, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
25
26    i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
27    lcd_0 = LCDUnit(i2c0, 0x3E)
28    label1 = Widgets.Label("LCD", 48, 109, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18, lcd_0)
29
30
31def loop():
32    global label0, label1, i2c0, lcd_0
33    M5.update()
34
35
36if __name__ == "__main__":
37    try:
38        setup()
39        while True:
40            loop()
41    except (Exception, KeyboardInterrupt) as e:
42        try:
43            from utility import print_error_msg
44
45            print_error_msg(e)
46        except ImportError:
47            print("please update to latest firmware")

示例输出:

None

API参考

class LCDUnit

class unit.lcd.LCDUnit(i2c, address=62)

基类:object

初始化 LCD Unit。

参数:
  • i2c (I2C | PAHUBUnit) – LCD Unit 所连接的 I2C 总线。

  • address (int) – LCD Unit 的 I2C 地址,默认为 0x3E。

UiFlow2 代码块:

LCDUnit 类继承了 Display 类,有关更多详细信息,请参阅 :ref:`hardware.Display <hardware.Display>` 。

MicroPython 代码块:

from unit import LCDUnit
lcd_0 = LCDUnit(i2c0, 0x3e)

LCDUnit class inherits Display class, See hardware.Display for more details.