]> Repositories - hackapet/Adafruit_Blinka_Displayio.git/blobdiff - displayio/_displaycore.py
Merge pull request #116 from makermelissa/main
[hackapet/Adafruit_Blinka_Displayio.git] / displayio / _displaycore.py
index 96c47a83a2e8e7a62744abbdae0d71eb982dac51..0672513c067d776cc6859abcf502fe9bc019c72b 100644 (file)
@@ -101,6 +101,7 @@ class _DisplayCore:
         if bus:
             if isinstance(bus, (FourWire, I2CDisplay, ParallelBus)):
                 self._bus_reset = bus.reset
         if bus:
             if isinstance(bus, (FourWire, I2CDisplay, ParallelBus)):
                 self._bus_reset = bus.reset
+                self._bus_free = bus._free
                 self._begin_transaction = bus._begin_transaction
                 self._send = bus._send
                 self._end_transaction = bus._end_transaction
                 self._begin_transaction = bus._begin_transaction
                 self._send = bus._send
                 self._end_transaction = bus._end_transaction
@@ -342,7 +343,7 @@ class _DisplayCore:
         if not self.data_as_commands:
             self.send(DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, data)
             data = bytearray(0)
         if not self.data_as_commands:
             self.send(DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, data)
             data = bytearray(0)
-        if self.ram_width < 0x100:  # Single Byte Bounds
+        if self.ram_height < 0x100:  # Single Byte Bounds
             data += struct.pack(">BB", region_y1, region_y2)
         else:
             if self.address_little_endian:
             data += struct.pack(">BB", region_y1, region_y2)
         else:
             if self.address_little_endian:
@@ -376,12 +377,14 @@ class _DisplayCore:
         """
         Send the data to the current bus
         """
         """
         Send the data to the current bus
         """
-        print(len(data))
-        if isinstance(data, memoryview):
-            data = data.tobytes()
-        print(data)
         self._send(data_type, chip_select, data)
 
         self._send(data_type, chip_select, data)
 
+    def bus_free(self) -> bool:
+        """
+        Check if the bus is free
+        """
+        return self._bus_free()
+
     def begin_transaction(self) -> bool:
         """
         Begin Bus Transaction
     def begin_transaction(self) -> bool:
         """
         Begin Bus Transaction