I cannot get it to display an image or paint a rectangle on the display. I can see the display reset using the code below but that's it. I have gotten this code working on a generic ST7789 display with the appropriate wiring.
Any help is appreciated.
Regards,
John
Connections are:
display -> pi
Vin -> 3.3
GND -> GND
SCK -> SCLK (D11)
MISO -> not connected
MOSI -> MOSI (D10)
TFTCS -> CE0 (D8)
RST -> D6
DC -> D5
SDCS -> not connected
LIT -> D4
I have SPI enabled and the latest versions of the required libraries:
pi@raspberrypi:~/135x240 $ ls /dev/*spi*
/dev/spidev0.0 /dev/spidev0.1 /dev/spidev1.0 /dev/spidev1.1 /dev/spidev1.2
ST7789 0.0.4
Pillow 8.1.2
Python 3.9.2
pi@raspberrypi:~/135x240 $ uname -a
Linux raspberrypi 5.10.63+ #1459 Wed Oct 6 16:40:27 BST 2021 armv6l GNU/Linux
Code: Select all
import ST7789
from PIL import Image
from time import sleep
display=ST7789.ST7789(port=0,cs=0,rst=6,dc=5,backlight=4,rotation=0,width=240,height=135,spi_speed_hz=160000000)
display._spi.mode=3
display.reset()
display._init()
image=Image.new('RGB',(240,135),(0,255,0))
display.display(image)
sleep(2)
image=Image.open("blinka.jpg")
image=image.resize((240,135),resample=Image.LANCZOS)
display.display(image)