]> Repositories - hackapet/Adafruit_Blinka_Displayio.git/blobdiff - i2cdisplaybus/__init__.py
A work-around for using byte-string as the data
[hackapet/Adafruit_Blinka_Displayio.git] / i2cdisplaybus / __init__.py
index f8383876dda6d8ac9ccf79727bfc71b7fccce065..b004e54ec4ebbc49322a391ad691e5835376fca6 100644 (file)
@@ -36,7 +36,7 @@ class I2CDisplayBus:
     """
 
     def __init__(self, i2c_bus: busio.I2C, *, device_address: int, reset=None):
     """
 
     def __init__(self, i2c_bus: busio.I2C, *, device_address: int, reset=None):
-        """Create a I2CDisplay object associated with the given I2C bus and reset pin.
+        """Create a I2CDisplayBus object associated with the given I2C bus and reset pin.
 
         The I2C bus and pins are then in use by the display until displayio.release_displays() is
         called even after a reload. (It does this so CircuitPython can use the display after your
 
         The I2C bus and pins are then in use by the display until displayio.release_displays() is
         called even after a reload. (It does this so CircuitPython can use the display after your
@@ -87,7 +87,9 @@ class I2CDisplayBus:
         done.
         """
         self._begin_transaction()
         done.
         """
         self._begin_transaction()
-        self._send(DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, bytes([command] + data))
+        # re-wrap in case of byte-string
+        buffer = list(data) if isinstance(data, bytes) else data
+        self._send(DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, bytes([command] + buffer))
         self._end_transaction()
 
     def _send(
         self._end_transaction()
 
     def _send(