Demos showing how to use CircuitPython displayio driver for GC9A01-based round LCDs. This driver is available in the CircuitPython Community Bundle, or you can install it by hand by copying the gc9a01.py
file to your CIRCUITPY/lib
directory, or use circup install gc9a01
.
import board
import busio
import fourwire
import displayio
import gc9a01
displayio.release_displays()
# Raspberry Pi Pico pinout, one possibility, at "southwest" of board
tft_clk = board.GP10 # must be a SPI CLK
tft_mosi= board.GP11 # must be a SPI TX
tft_rst = board.GP12
tft_dc = board.GP13
tft_cs = board.GP14 # optional, can be "None"
tft_bl = board.GP15 # optional, can be "None"
spi = busio.SPI(clock=tft_clk, MOSI=tft_mosi)
display_bus = fourwire.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=tft_rst)
display = gc9a01.GC9A01(display_bus, width=240, height=240, backlight_pin=tft_bl)
# ... normal circuitpython displayio stuff
Each of the .py files in "examples" is its own demo. Copy one of these to be your CIRCUITPY's "code.py", like:
cp gc9a01_hellocircles.py /Volumes/CIRCUITPY/code.py
You'll need to install various libraries. Most notably the gc9a01
library. You may also
need the adafruit_display_text
and adafruit_imageload
, depending on the example.
The easiest way to install these is from a terminal:
circup install gc9a01
circup install adafruit_display_text
circup install adafruit_imageload
Check out the 'examples' directory for complete examples:
vectorio
bitmaptools.rotozoom
The examples attempt to auto-detect the board you're using. The currently detected boards:
Additionally, there are several demos in the "examples/eyeballs" directory that use these round displays to make moving eyes.
Wiring is dependent on board you're hooking it up to. The "SCL" and "SDA" lines need to be
hooked up to SPI pins "SCK" and "MOSI/TX". The gc9a01_helloworld.py
has example wirings for three
different boards. Here is an example for the Pico:
Here is an example for a QT Py Haxpress:
There is a partial Python port of @bikerglen's gauge-generator in docs/gauge-generator
. These scripts use the wonderful Wand Python wrapper for ImageMagick's C API.