X-Git-Url: https://git.ayoreis.com/hackapet/Adafruit_Blinka_Displayio.git/blobdiff_plain/07b3c4b67d4530d1b04e725899dcdf077d462d6e..b39699fa4b1ed4838b72d068f0c13fdf62ef95de:/displayio/_displaycore.py diff --git a/displayio/_displaycore.py b/displayio/_displaycore.py index 96c47a8..9e1ba4b 100644 --- a/displayio/_displaycore.py +++ b/displayio/_displaycore.py @@ -101,6 +101,7 @@ class _DisplayCore: 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 @@ -117,16 +118,13 @@ class _DisplayCore: self.rotation = rotation self.transform = TransformStruct() + self.set_rotation(rotation) + def set_rotation(self, rotation: int) -> None: """ Sets the rotation of the display as an int in degrees. """ # pylint: disable=protected-access, too-many-branches - transposed = self.rotation in (90, 270) - will_be_transposed = rotation in (90, 270) - if transposed != will_be_transposed: - self.width, self.height = self.height, self.width - height = self.height width = self.width @@ -175,9 +173,6 @@ class _DisplayCore: self.transform.y = height self.transform.dy = -1 - if self.current_group is not None: - self.current_group._update_transform(self.transform) - def set_root_group(self, root_group: Group) -> bool: """ Switches to displaying the given group of layers. When group is `None`, the @@ -288,7 +283,7 @@ class _DisplayCore: else: region_y1 //= pixels_per_byte * self.colorspace.bytes_per_cell region_y2 //= pixels_per_byte * self.colorspace.bytes_per_cell - + print(region_y2) region_x2 -= 1 region_y2 -= 1 @@ -342,7 +337,7 @@ class _DisplayCore: 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: @@ -376,12 +371,14 @@ class _DisplayCore: """ 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) + def bus_free(self) -> bool: + """ + Check if the bus is free + """ + return self._bus_free() + def begin_transaction(self) -> bool: """ Begin Bus Transaction