diff --git a/wasp/boards/simulator/display.py b/wasp/boards/simulator/display.py index 8efbb9c..379760c 100644 --- a/wasp/boards/simulator/display.py +++ b/wasp/boards/simulator/display.py @@ -37,6 +37,11 @@ class ST7789Sim(object): self.cmd = 0 def write(self, data): + # Converting data to a memoryview ensures we act more like spi.write() + # when running in a real device (e.g. data must be bytes-like object + # that implements the buffer protocol) + data = memoryview(data) + if len(data) == 1: # Assume if we get a byte at a time then it is command. # This is a simplification do we don't have to track diff --git a/wasp/drivers/st7789.py b/wasp/drivers/st7789.py index 013ee1b..be4b109 100644 --- a/wasp/drivers/st7789.py +++ b/wasp/drivers/st7789.py @@ -181,8 +181,8 @@ class ST7789_SPI(ST7789): Send data to the display as part of an optimized write sequence. - :param bytearray buf: Data, must be in a form that can be directly - consumed by the SPI bus. + :param bytes-like buf: Data, must be in a form that can be directly + consumed by the SPI bus. """ def __init__(self, width, height, spi, cs, dc, res=None, rate=8000000): """Configure the display.