2020-11-05 10:10:21 +00:00
|
|
|
# color_setup.py Customise for your hardware config
|
2020-11-03 18:43:24 +00:00
|
|
|
|
|
|
|
# Released under the MIT License (MIT). See LICENSE.
|
2024-05-12 10:19:11 +00:00
|
|
|
# Copyright (c) 2024 Peter Hinch
|
2020-11-03 18:43:24 +00:00
|
|
|
|
2020-11-05 10:10:21 +00:00
|
|
|
# As written, supports:
|
2024-05-12 10:19:11 +00:00
|
|
|
# gc9a01 240x240 circular display on Pi Pico
|
2020-11-05 10:10:21 +00:00
|
|
|
# Edit the driver import for other displays.
|
|
|
|
|
2020-11-03 18:43:24 +00:00
|
|
|
# Demo of initialisation procedure designed to minimise risk of memory fail
|
|
|
|
# when instantiating the frame buffer. The aim is to do this as early as
|
|
|
|
# possible before importing other modules.
|
|
|
|
|
2022-12-06 17:51:54 +00:00
|
|
|
# WIRING
|
|
|
|
# Pico Display
|
|
|
|
# GPIO Pin
|
|
|
|
# 3v3 36 Vin
|
|
|
|
# IO6 9 CLK Hardware SPI0
|
|
|
|
# IO7 10 DATA (AKA SI MOSI)
|
|
|
|
# IO8 11 DC
|
|
|
|
# IO9 12 Rst
|
|
|
|
# Gnd 13 Gnd
|
|
|
|
# IO10 14 CS
|
|
|
|
|
|
|
|
from machine import Pin, SPI
|
2020-11-03 18:43:24 +00:00
|
|
|
import gc
|
2020-11-05 10:10:21 +00:00
|
|
|
|
|
|
|
# *** Choose your color display driver here ***
|
2022-12-06 17:51:54 +00:00
|
|
|
# ili9341 specific driver
|
2024-05-12 10:19:11 +00:00
|
|
|
from drivers.gc9a01.gc9a01 import GC9A01 as SSD
|
|
|
|
|
|
|
|
# from drivers.ili93xx.ili9341 import ILI9341 as SSD
|
2020-11-05 10:10:21 +00:00
|
|
|
|
2022-12-06 17:51:54 +00:00
|
|
|
pdc = Pin(8, Pin.OUT, value=0) # Arbitrary pins
|
|
|
|
prst = Pin(9, Pin.OUT, value=1)
|
|
|
|
pcs = Pin(10, Pin.OUT, value=1)
|
2020-11-03 18:43:24 +00:00
|
|
|
|
2022-12-06 17:51:54 +00:00
|
|
|
# Kept as ssd to maintain compatability
|
2020-11-03 18:43:24 +00:00
|
|
|
gc.collect() # Precaution before instantiating framebuf
|
2022-12-06 17:51:54 +00:00
|
|
|
# See DRIVERS.md re overclocking the SPI bus
|
|
|
|
spi = SPI(0, sck=Pin(6), mosi=Pin(7), miso=Pin(4), baudrate=30_000_000)
|
2024-05-12 10:19:11 +00:00
|
|
|
ssd = SSD(spi, dc=pdc, cs=pcs, rst=prst, lscape=False, usd=False, mirror=False)
|
|
|
|
# ssd = SSD(spi, dc=pdc, cs=pcs, rst=prst, width=240)
|