LilyGo T-DISPLAY RP2040 135x240

https://www.lilygo.cc/products/t-display-rp2040

tft_configs/ttgo_tdisplay_rp2040/tft_config.py

 1"""LilyGo T-DISPLAY RP2040 135x240
 2
 3https://www.lilygo.cc/products/t-display-rp2040
 4
 5"""
 6from machine import Pin, SPI
 7import st7789py as st7789
 8
 9TFA = 40
10BFA = 40
11WIDE = 1
12TALL = 0
13SCROLL = 0      # orientation for scroll.py
14FEATHERS = 1    # orientation for feathers.py
15
16def config(rotation=0):
17    """
18    Configures and returns an instance of the ST7789 display driver.
19
20    Args:
21        rotation (int): The rotation of the display (default: 0).
22
23    Returns:
24        ST7789: An instance of the ST7789 display driver.
25    """
26
27    return st7789.ST7789(
28        SPI(0, baudrate=60000000, sck=Pin(2), mosi=Pin(3), miso=None),
29        135,
30        240,
31        reset=Pin(0, Pin.OUT),
32        cs=Pin(5, Pin.OUT),
33        dc=Pin(1, Pin.OUT),
34        backlight=Pin(4, Pin.OUT),
35        rotation=rotation)

tft_configs/ttgo_tdisplay_rp2040/tft_buttons.py

T-Display RP2040 Buttons configuration.

 1"""
 2T-Display RP2040 Buttons configuration.
 3"""
 4
 5from machine import Pin
 6
 7class Buttons():
 8    """
 9    Buttons class for examples, modify for your device.
10
11    Attributes:
12        name (str): The name of the device.
13        left (Pin): The Pin object representing the left button.
14        right (Pin): The Pin object representing the right button.
15        fire (Pin): The Pin object representing the fire button.
16        thrust (Pin): The Pin object representing the thrust button.
17        hyper (Pin): The Pin object representing the hyper button.
18    """
19
20    def __init__(self):
21        self.name = "tdisplay_rp2040"
22        self.left = Pin(6, Pin.IN)
23        self.right = Pin(7, Pin.IN)
24        self.fire = None
25        self.thrust = None
26        self.hyper = None