"""
ILI9341 Pin	Raspberry Pi Pico Pin	Purpose
VCC	3.3V	Power
GND	GND	Ground
CS	GP17	Chip Select
RESET	GP16	Reset
DC/RS	GP15	Data/Command
MOSI	GP11	SPI0 TX
SCK	GP10	SPI0 SCK
LED	3.3V	Backlight Power
"""
from machine import Pin, SPI
from ili934xnew import ILI9341, color565
import glcdfont
import time
from draw_line import draw_line
from draw_circle import draw_circle
from draw_triangle import draw_triangle

# spi setup for the display
spi = SPI(1, baudrate=40000000, sck=Pin(10), mosi=Pin(11))

display = ILI9341(
    spi=spi,
    cs=Pin(17),
    dc=Pin(15),
    rst=Pin(16),
    w=240,
    h=320,
    r=0
)

# clear the screen
display.fill_rectangle(0, 0, 240, 320, color565(0, 0, 0))

# Draw some text
# display.set_font(glcdfont)
# display.print("Hello World, This is such a great day, that we are learning")

while True :
    # draw_rectangle(display, color565)
    #draw_line(display, 0, 0, 100, 100, color565(255, 255, 255))
    # draw_circle(display, 120, 160, 30, color565(255, 255, 255))
    draw_triangle(display, 50, 250, 100, 300, 10, 300, color565(255, 255, 255))
    time.sleep(100)
   
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT