Closed katkinsk closed 4 years ago
You've mentioned the problem that relates to the way how SPI methods work. I don't think it is an issue in the library as it depends on the arguments you provide for the method and it could be prepared before writing to SPI
display.write(command, data=payload or None)
I am not completely sure what you mean, but let me clarify it fails on the init method, so I haven't begun to write anything to the display yet at this point.
I had a similar problem with a different display (ssd1331) but to fix that one all I had to say was "if data != b''" instead of "if data is not None", but in this case when the display is initializing it is being sent both nulls and empty byte strings.
Could you please provide your code to show how you initialize the display to let me check the issue
from display import st7789py from pyb import Pin, SPI spi = SPI(1, SPI.MASTER, baudrate=40000000, polarity=1) display = st7789py.ST7789(spi, 240, 240, dc=Pin('X3', Pin.OUT_PP), reset=Pin('X4', Pin.OUT_PP)) display.init()
Fixed in the commit 6ed627bdc876e0f6741682764871ffce83f2762d. Thanks for the report.
Currently: def write(self, command=None, data=None): """SPI write to the device: commands and data""" self.cs_low() if command is not None: self.dc_low() self.spi.write(bytes([command])) if data is not None: self.dc_high() self.spi.write(data) self.cs_high()
Was able to fix it to work by changing to: if data is not None and data != b'':
Both regular nulls and empty byte strings are passed to the function.