adafruit / Adafruit_CircuitPython_RGB_Display

Drivers for RGB displays for Adafruit CircuitPython.
MIT License
131 stars 52 forks source link

Driver for ST7735S #55

Closed philippkeller closed 4 years ago

philippkeller commented 4 years ago

I got a Waveshare 1.8inch LCD module which follows the ST7735S standard. As neither ST7735 nor ST7735R worked for me, I transferred the needed control commands from the example code I got with the module into this project.

I run it on my Raspberry pi like this:

import busio
import digitalio
from board import SCK, MOSI, CE0, D24, D25, D27
from PIL import Image, ImageDraw

from adafruit_rgb_display import color565
import adafruit_rgb_display.st7735 as st7735

# Setup SPI bus using hardware SPI:
spi = busio.SPI(clock=SCK, MOSI=MOSI)

# Create the ST7735S display:
display = st7735.ST7735S(spi, cs=digitalio.DigitalInOut(CE0),
                          dc=digitalio.DigitalInOut(D25),
                          rst=digitalio.DigitalInOut(D27),
                          bl=digitalio.DigitalInOut(D24),
                          width=160,height=128,x_offset=1,y_offset=2,
                          )

display.fill(color565(0,0,0))
display.pixel(50, 50, color565(255, 0, 0))

Wiring: