# Generic ESP32 320x240

## tft_configs/esp32_320x240/tft_config.py

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

## tft_configs/esp32_320x240/tft_buttons.py

Generic ESP32 with Two buttons

     1"""
     2Generic ESP32 with Two buttons
     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 = "esp32"
    22        self.left = Pin(0, Pin.IN)
    23        self.right = Pin(35, Pin.IN)
    24        self.fire = None
    25        self.thrust = None
    26        self.hyper = None