1 # SPDX-FileCopyrightText: 2020 Melissa LeBlanc-Williams for Adafruit Industries
3 # SPDX-License-Identifier: MIT
7 ================================================================================
11 **Software and Dependencies:**
14 https://github.com/adafruit/Adafruit_Blinka/releases
16 * Author(s): Melissa LeBlanc-Williams
20 from typing import Union
21 from ._fourwire import FourWire
22 from ._i2cdisplay import I2CDisplay
23 from ._bitmap import Bitmap
24 from ._colorspace import Colorspace
25 from ._colorconverter import ColorConverter
26 from ._display import Display
27 from ._epaperdisplay import EPaperDisplay
28 from ._group import Group
29 from ._ondiskbitmap import OnDiskBitmap
30 from ._palette import Palette
31 from ._shape import Shape
32 from ._tilegrid import TileGrid
33 from ._displaybus import _DisplayBus
34 from ._constants import CIRCUITPY_DISPLAY_LIMIT
36 __version__ = "0.0.0+auto.0"
37 __repo__ = "https://github.com/adafruit/Adafruit_Blinka_displayio.git"
45 """Main thread function to loop through all displays and update them"""
46 for display in displays:
50 def release_displays() -> None:
51 """Releases any actively used displays so their busses and pins can be used again.
53 Use this once in your code.py if you initialize a display. Place it right before the
54 initialization so the display is active as long as possible.
56 for display in displays:
60 for display_bus in display_buses:
65 def allocate_display(new_display: Union[Display, EPaperDisplay]) -> None:
66 """Add a display to the displays pool and return the new display"""
67 if len(displays) >= CIRCUITPY_DISPLAY_LIMIT:
68 raise RuntimeError("Too many displays")
69 displays.append(new_display)
72 def allocate_display_bus(new_display_bus: _DisplayBus) -> None:
73 """Add a display bus to the display_buses pool and return the new display bus"""
74 if len(display_buses) >= CIRCUITPY_DISPLAY_LIMIT:
76 "Too many display busses; forgot displayio.release_displays() ?"
78 display_buses.append(new_display_bus)
81 background_thread = threading.Thread(target=_background, daemon=True)
84 # Start the background thread
85 def _start_background():
86 if not background_thread.is_alive():
87 background_thread.start()
90 def _stop_background():
91 if background_thread.is_alive():
93 background_thread.join()