Add setup example for Waveshare Pico Res Touch 2.8

pull/34/head
Peter Hinch 2022-05-07 17:13:06 +01:00
rodzic c8daa602ef
commit 03c067fd5d
1 zmienionych plików z 26 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,26 @@
# ws_pico_res_touch.py
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2022 Peter Hinch
# With help from Tim Wermer.
import gc
from machine import Pin, SPI
from drivers.st7789.st7789_4bit import *
SSD = ST7789
pdc = Pin(8, Pin.OUT, value=0)
pcs = Pin(9, Pin.OUT, value=1)
prst = Pin(15, Pin.OUT, value=1)
pbl = Pin(13, Pin.OUT, value=1)
gc.collect() # Precaution before instantiating framebuf
# Runs at 60MHz here, supported by ST7789 datasheet.
# If problems arise, try reducing to 30MHz.
spi = SPI(1, 60_000_000, sck=Pin(10), mosi=Pin(11), miso=Pin(12))
# Define the display
# For portrait mode:
# ssd = SSD(spi, height=320, width=240, dc=pdc, cs=pcs, rst=prst)
# For landscape mode:
ssd = SSD(spi, height=240, width=320, disp_mode=PORTRAIT, dc=pdc, cs=pcs, rst=prst)