Trouble getting Peter's CWriter to work on Waveshare 1.14" display #11064
-
|
I've searched around and different setups I've tried don't work. All I get is a blank dark display. I know it works as the Waveshare demo works fine. I'm trying to get larger font text on the display. Hopefully someone here can help me out. Here's my latest: Here's the terminal output: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
The problem arises because this display driver uses 4-bit color. Creating a color involves populating a lookup table: in your script the LUT is un-initialised so all colors are black. This is discussed in the nano-gui docs here. The simplest approach is to use and import the from machine import Pin, SPI
import gc
from gui.core.writer import CWriter
import gui.fonts.freesans20 as freesans20 # Font to use
from gui.core.colors import *
from drivers.st7789.st7789_4bit import *
SSD = ST7789
gc.collect() # Precaution before instantiating framebuf
# Conservative low baudrate. Can go to 62.5MHz.
spi = SPI(1, 30_000_000, sck=Pin(10), mosi=Pin(11), miso=None)
pcs = Pin(9, Pin.OUT, value=1)
prst = Pin(12, Pin.OUT, value=1)
pbl = Pin(13, Pin.OUT, value=1)
pdc = Pin(8, Pin.OUT, value=0)
ssd = SSD(spi, height=135, width=240, dc=pdc, cs=pcs, rst=prst, disp_mode=LANDSCAPE, display=TDISPLAY)
# Demo drawing geometric shapes using underlying framebuf methods
rhs = ssd.width -1
ssd.line(rhs - 20, 0, rhs, 20, GREEN)
square_side = 10
ssd.fill_rect(rhs - square_side, 0, square_side, square_side, GREEN)
# Instantiate a writer for a specific font
wri = CWriter(ssd, freesans20) # Can set verbose = False to suppress console output
CWriter.set_textpos(ssd, 0, 0) # In case a previous test has altered this
wri.setcolor(RED, BLACK) # Colors can be set in constructor or changed dynamically
wri.printstring('Testing')
ssd.show() |
Beta Was this translation helpful? Give feedback.
The problem arises because this display driver uses 4-bit color. Creating a color involves populating a lookup table: in your script the LUT is un-initialised so all colors are black. This is discussed in the nano-gui docs here.
The simplest approach is to use and import the
colors.pyfile which creates a number of colors and also shows how you can create your own. You also need theboolpalette.pyin thedriversdirectory. The following script works here, with directory paths amended to match thenanoguidirectory structure.