kopia lustrzana https://github.com/peterhinch/micropython-nano-gui
27 wiersze
797 B
Python
27 wiersze
797 B
Python
![]() |
# 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)
|