SPI Attached Displays

Custom Display Driver Code

If a display is not directly supported by the Linux kernel or when the support does not expose some desired functionality you must roll your own driver code.

The Pytorinox library provides some example drivers for IL3820, SSD1306, SSD1327, SH1106 driver chips in file spi_display.py

More example code can be found in the reference section.

Using Pytorinox' Custom Display Drivers

We use the SH1106 drive as an example

from PIL import Image, ImageDraw
from spi_display import SH1106 # pytorinox
import RPi.GPIO as GPIO

dev = SpiDevice(device=0, port=0, dc_pin=18, reset_pin=22)
display = SH1106(dev, w=128, h=64)
buffer = Image.new(mode="1", size=display.size)
draw = ImageDraw.Draw(buffer)
cx = fb.size[0] // 2
cy = fb.size[1] // 2
draw.rectangle((cx-10, cy-10, cx+10,  cy+10), "white")