Waveshare Pico LCD 1.3 240x240
https://www.waveshare.com/wiki/Pico-LCD-1.3
tft_configs/waveshare_13/tft_config.py
1"""Waveshare Pico LCD 1.3 240x240
2
3https://www.waveshare.com/wiki/Pico-LCD-1.3
4
5"""
6
7from machine import Pin, SPI
8import st7789py as st7789
9
10TFA = 0
11BFA = 80
12WIDE = 1
13TALL = 0
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. Defaults to 0.
23
24 Returns:
25 ST7789: An instance of the ST7789 display driver.
26 """
27
28 return st7789.ST7789(
29 SPI(1, baudrate=60000000, polarity=1, sck=Pin(10), mosi=Pin(11), miso=None),
30 240,
31 240,
32 reset=Pin(12, Pin.OUT),
33 cs=Pin(9, Pin.OUT),
34 dc=Pin(8, Pin.OUT),
35 backlight=Pin(13, Pin.OUT),
36 rotation=rotation,
37 )
tft_configs/waveshare_13/tft_buttons.py
Waveshare 1.3” TFT display with ST7789 controller
1"""
2Waveshare 1.3" TFT display with ST7789 controller
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 = "waveshare_13"
22 self.left = Pin(16, Pin.IN, Pin.PULL_UP) # Joystick left
23 self.right = Pin(20, Pin.IN, Pin.PULL_UP) # Joystick right
24 self.fire = Pin(21, Pin.IN, Pin.PULL_UP) # Joystick press
25 self.thrust = Pin(3, Pin.IN, Pin.PULL_UP) # Y button
26 self.hyper = Pin(15, Pin.IN, Pin.PULL_UP) # A button