X-Git-Url: https://git.ayoreis.com/hackapet/Adafruit_Blinka_Displayio.git/blobdiff_plain/3ace921d8f91d4d3b83fe6ae27a41beadc25fd46..d86b9125007033a7efb82008497b6b856333ca9c:/displayio/_display.py diff --git a/displayio/_display.py b/displayio/_display.py index 2a6ea7b..9572a81 100644 --- a/displayio/_display.py +++ b/displayio/_display.py @@ -327,7 +327,7 @@ class Display: ) return areas - def background(self): + def _background(self): """Run background refresh tasks. Do not call directly""" if ( self._auto_refresh @@ -338,7 +338,7 @@ class Display: def _refresh_area(self, area) -> bool: """Loop through dirty areas and redraw that area.""" - # pylint: disable=too-many-locals + # pylint: disable=too-many-locals, too-many-branches clipped = Area() # Clip the area to the display by overlapping the areas. @@ -401,9 +401,14 @@ class Display: 8 // self._core.colorspace.depth ) - buffer = memoryview(bytearray([0] * (buffer_size * 4))) - mask = memoryview(bytearray([0] * mask_length)) + buffer = memoryview(bytearray([0] * (buffer_size * 4))).cast("I") + mask = memoryview(bytearray([0] * (mask_length * 4))).cast("I") self._core.fill_area(subrectangle, mask, buffer) + + # Can't acquire display bus; skip the rest of the data. + if not self._core.bus_free(): + return False + self._core.begin_transaction() self._send_pixels(buffer[:subrectangle_size_bytes]) self._core.end_transaction() @@ -427,12 +432,12 @@ class Display: self._core.fill_area(area, mask, buffer) return buffer - def release(self) -> None: + def _release(self) -> None: """Release the display and free its resources""" self.auto_refresh = False self._core.release_display_core() - def reset(self) -> None: + def _reset(self) -> None: """Reset the display""" self.auto_refresh = True circuitpython_splash.x = 0