I've been experimenting with a Waveshare 320x240 with ST7789 driver, I've searched high and low for an answer with no success...
https://www.waveshare.com/pico-restouch-lcd-2.8.htm
I have used the firmware and example and cfg_helper.py from 'russhughes' github https://github.com/russhughes/st7789_mpy and I repeatedly get the same syntax error shown below...
Code: Select all
>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
File "<stdin>", line 10, in <module>
File "tft_config.py", line 16
SyntaxError: invalid syntax
>>>
Code: Select all
# Generic st7735 128x128 OR 128X160 display
BAUDRATE = 30000000
COLUMNS = 240
ROWS = 320
SCK_PIN = 10
MOSI_PIN = 11
RESET_PIN = 12
CS_PIN = 9
DC_PIN = 8
BACKLIGHT_PIN = 13
rotation = 0
madctl = 0x00 ()
inversion_mode(True)
color_order = st7789.RGB
for rotation 0 use offset(0, 0)
for rotation 1 use offset(0, 0)
for rotation 2 use offset(0, 0)
for rotation 3 use offset(0, 0)
Code: Select all
"""
hello.py
Writes "Hello!" in random colors at random locations on the display.
"""
import random
import utime
import st7789
import tft_config
import vga1_bold_16x32 as font
tft = tft_config.config(0)
def center(text):
length = len(text)
tft.text(
font,
text,
tft.width() // 2 - length // 2 * font.WIDTH,
tft.height() // 2 - font.HEIGHT,
st7789.WHITE,
st7789.RED)
def main():
tft.init()
tft.fill(st7789.RED)
center("Hello!")
utime.sleep(2)
tft.fill(st7789.BLACK)
while True:
for rotation in range(4):
tft.rotation(rotation)
tft.fill(0)
col_max = tft.width() - font.WIDTH*6
row_max = tft.height() - font.HEIGHT
for _ in range(128):
tft.text(
font,
"Hello!",
random.randint(0, col_max),
random.randint(0, row_max),
st7789.color565(
random.getrandbits(8),
random.getrandbits(8),
random.getrandbits(8)),
st7789.color565(
random.getrandbits(8),
random.getrandbits(8),
random.getrandbits(8)))
main()