# LilyGo T-embed 170x320

## tft_configs/t-embed/tft_config.py

     1"""LilyGo T-embed 170x320
     2"""
     3
     4from machine import Pin, SPI
     5import st7789py as st7789
     6
     7
     8TFA = 0
     9BFA = 0
    10WIDE = 1
    11TALL = 0
    12SCROLL = 0      # orientation for scroll.py
    13FEATHERS = 1    # orientation for feathers.py
    14
    15POWER = Pin(46, Pin.OUT, value=1)
    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, 170, 320, 35, 0, False),
    30        (0x60, 320, 170, 0, 35, False),
    31        (0xC0, 170, 320, 35, 0, False),
    32        (0xA0, 320, 170, 0, 35, False),
    33    )
    34
    35    return st7789.ST7789(
    36        SPI(2, baudrate=40000000, sck=Pin(12), mosi=Pin(11), miso=None),
    37        170,
    38        320,
    39        cs=Pin(10, Pin.OUT),
    40        dc=Pin(13, Pin.OUT),
    41        reset=Pin(9, Pin.OUT),
    42        backlight=Pin(15, Pin.OUT),
    43        custom_rotations=custom_rotations,
    44        rotation=rotation,
    45        color_order=st7789.BGR,
    46    )

## tft_configs/t-embed/tft_buttons.py

> Buttons class for examples, modify for your device.

> Attributes:

>   name (str): The name of the device. left (Pin): The Pin object representing the left button. right (Pin): The Pin object representing the right button. fire (Pin): The Pin object representing the fire button. thrust (Pin): The Pin object representing the thrust button. hyper (Pin): The Pin object representing the hyper button.

     1# input pins for buttons: you will need to change these to match your wiring
     2
     3from machine import Pin
     4
     5
     6class Buttons:
     7    """
     8    Buttons class for examples, modify for your device.
     9
    10    Attributes:
    11        name (str): The name of the device.
    12        left (Pin): The Pin object representing the left button.
    13        right (Pin): The Pin object representing the right button.
    14        fire (Pin): The Pin object representing the fire button.
    15        thrust (Pin): The Pin object representing the thrust button.
    16        hyper (Pin): The Pin object representing the hyper button.
    17    """
    18
    19    def __init__(self):
    20        self.name = "t-embed"
    21        self.left = Pin(17, Pin.IN, Pin.PULL_UP)  # middle GROVE connector
    22        self.right = Pin(18, Pin.IN, Pin.PULL_UP)
    23
    24        # need more buttons for roids.py
    25        self.fire = None
    26        self.thrust = None
    27        self.hyper = None