Skip to content

tylercrumpton/CircuitPython_GC9D01

Repository files navigation

Introduction

Discord Build Status Code Style: Black

displayio driver for GC9D01 TFT LCD displays

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Installing from PyPI

Note

This library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install circuitpython-gc9d01

To install system-wide (this may be required in some cases):

sudo pip3 install circuitpython-gc9d01

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .env/bin/activate
pip3 install circuitpython-gc9d01

Installing to a Connected CircuitPython Device with Circup

Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:

pip3 install circup

With circup installed and your CircuitPython device connected use the following command to install:

circup install gc9d01

Or the following command to update an existing version:

circup update

Usage Example

import board
import displayio
from gc9d01 import GC9D01

spi = board.SPI()
while not spi.try_lock():
    pass
spi.configure(baudrate=24000000)  # Configure SPI for 24MHz
spi.unlock()
cs = board.D10
dc = board.D13
reset = board.D11

displayio.release_displays()
display_bus = displayio.FourWire(spi, command=dc, chip_select=cs, reset=reset)

display = GC9D01(
    display_bus, width=160, height=40, rotation=90, backlight_pin=board.IO16
)

# Make the display context
splash = displayio.Group()
display.show(splash)

color_bitmap = displayio.Bitmap(160, 40, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0x03C2FC

bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)

while True:
    pass

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.