Glass2 Unit

Glass2 Unit is a 1.51-inch transparent OLED display unit that adopts the SSD1309 driver solution.

Support the following products:

Glass2Unit

Micropython Example:

 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
10
11
12label0 = None
13label1 = None
14i2c0 = None
15glass2_0 = None
16
17
18def setup():
19    global label0, label1, i2c0, glass2_0
20
21    M5.begin()
22    Widgets.fillScreen(0x222222)
23    label0 = Widgets.Label("CoreS3", 127, 109, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
24
25    i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
26    glass2_0 = M5.addDisplay(i2c0, 0x3C, {"unit_glass2": True})
27    label1 = Widgets.Label(
28        "GLASS2", 26, 21, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18, glass2_0
29    )
30
31
32def loop():
33    global label0, label1, i2c0, glass2_0
34    M5.update()
35
36
37if __name__ == "__main__":
38    try:
39        setup()
40        while True:
41            loop()
42    except (Exception, KeyboardInterrupt) as e:
43        try:
44            from utility import print_error_msg
45
46            print_error_msg(e)
47        except ImportError:
48            print("please update to latest firmware")

UIFLOW2 Example:

example.png

cores3_glass2_example.m5f2

class Glass2Unit

Constructors

class Glass2Unit(i2c, address: int = 0x3c, freq: int = 400000)

Initialize the Unit Glass2

参数:
  • i2c (I2C) – the I2C object.

  • address (int) – I2C address of the Unit Glass2, default is 0x3c.

  • freq (int) – I2C frequency of the Unit Glass2.

UIFLOW2:

init.png