"""
lines.py
Draws lines and rectangles in random colors at random locations on the
display.
"""
import random
from machine import Pin, SoftSPI ,SPI
import st7789py as st7789
import gfx
from time import sleep
def main():
screen_width=320
screen_height=240
spi = SoftSPI(
#spi = SPI(0,
baudrate=20000000,
polarity=1,
phase=0,
sck=Pin(2),
mosi=Pin(3),
miso=Pin(0))
tft = st7789.ST7789(
spi,
320,
240,
reset=Pin(6, Pin.OUT),
cs=Pin(8, Pin.OUT),
dc=Pin(7, Pin.OUT),
backlight=Pin(9, Pin.OUT),
rotation=0)
#tft.fill(st7789.RED)
tft.rect(40, 10, 120, 100, st7789.WHITE)
sleep(0.1) # 0.1 sec = 100 ms
scale = -5
tft.fill_rect(40+scale, 10+scale, 120+scale, 100+scale, st7789.RED)
sleep(0.1) # 0.1 sec = 100 ms
#graphics = gfx.GFX(screen_width, screen_height, tft.pixel)
#graphics.line(0, 0, 127, 20, 1)
#tft.show()
sleep(0.1) # 0.1 sec = 100 ms
main()