LilyGo T-QT Pro 128x128 (GC9107)

https://www.lilygo.cc/products/t-qt-pro

tft_configs/t_qt_pro/tft_config.py

 1"""LilyGo T-QT Pro 128x128 (GC9107)
 2
 3https://www.lilygo.cc/products/t-qt-pro
 4
 5"""
 6
 7from machine import Pin, SPI
 8import st7789py as st7789
 9
10TFA = 1
11BFA = 3
12WIDE = 2
13TALL = 3
14SCROLL = 0      # orientation for scroll.py
15FEATHERS = 1    # orientation for feathers.py
16
17def config(rotation=0):
18    """
19    Configures and returns an instance of the ST7789 display driver.
20
21    Args:
22        rotation (int): The rotation of the display (default: 0).
23
24    Returns:
25        ST7789: An instance of the ST7789 display driver.
26    """
27
28    custom_rotations = (
29        (0x00, 128, 128, 2, 1, False),
30        (0x60, 128, 128, 1, 2, False),
31        (0xc0, 128, 128, 2, 1, False),
32        (0xa0, 128, 128, 1, 2, False),
33    )
34
35    return st7789.ST7789(
36        SPI(2, baudrate=40000000, sck=Pin(3), mosi=Pin(2), miso=None),
37        128,
38        128,
39        reset=Pin(1, Pin.OUT),
40        cs=Pin(5, Pin.OUT),
41        dc=Pin(6, Pin.OUT),
42        #backlight=Pin(10, Pin.OUT),
43        rotation=rotation,
44        custom_rotations=custom_rotations,
45        color_order=st7789.BGR
46    )

tft_configs/t_qt_pro/tft_buttons.py

LILYGO® T-QT Pro buttons

 1"""
 2LILYGO® T-QT Pro buttons
 3"""
 4
 5from machine import Pin
 6
 7
 8class Buttons:
 9    """
10    Buttons class for examples, modify for your device.
11
12    Attributes:
13        name (str): The name of the device.
14        left (Pin): The Pin object representing the left button.
15        right (Pin): The Pin object representing the right button.
16        fire (Pin): The Pin object representing the fire button.
17        thrust (Pin): The Pin object representing the thrust button.
18        hyper (Pin): The Pin object representing the hyper button.
19    """
20
21    def __init__(self):
22        self.name = "t-qt-pro"
23        self.left = Pin(0, Pin.IN)
24        self.right = Pin(47, Pin.IN)
25
26        # need more buttons for roids.py
27        self.fire = None
28        self.thrust = None
29        self.hyper = None