import digitalio
import microcontroller
from circuitpython_typing import WriteableBuffer, ReadableBuffer
-from ._displaycore import _DisplayCore
+from displayio._displaycore import _DisplayCore
from ._displaybus import _DisplayBus
-from ._colorconverter import ColorConverter
-from ._group import Group, circuitpython_splash
-from ._area import Area
-from ._constants import (
+from displayio._colorconverter import ColorConverter
+from displayio._group import Group, circuitpython_splash
+from displayio._area import Area
+from displayio._constants import (
CHIP_SELECT_TOGGLE_EVERY_BYTE,
CHIP_SELECT_UNTOUCHED,
DISPLAY_COMMAND,
__repo__ = "https://github.com/adafruit/Adafruit_Blinka_displayio.git"
-class Display:
+class BusDisplay:
# pylint: disable=too-many-instance-attributes, too-many-statements
"""This initializes a display and connects it into CircuitPython. Unlike other objects
in CircuitPython, Display objects live until ``displayio.release_displays()`` is called.
self.auto_refresh = auto_refresh
def __new__(cls, *args, **kwargs):
- from . import ( # pylint: disable=import-outside-toplevel, cyclic-import
+ from ..displayio import ( # pylint: disable=import-outside-toplevel, cyclic-import
allocate_display,
)
)
self._core.send(DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, pixels)
- def show(self, group: Group) -> None:
- """
- .. note:: `show()` is deprecated and will be removed when CircuitPython 9.0.0
- is released. Use ``.root_group = group`` instead.
-
- Switches to displaying the given group of layers. When group is None, the
- default CircuitPython terminal will be shown.
-
- :param Group group: The group to show.
- """
- if group is None:
- group = circuitpython_splash
- self._core.set_root_group(group)
+ def show(self, _group: Group) -> None: # pylint: disable=missing-function-docstring
+ raise AttributeError(".show(x) removed. Use .root_group = x")
def _set_root_group(self, root_group: Group) -> None:
ok = self._core.set_root_group(root_group)
# SPDX-License-Identifier: MIT
"""
-`displayio._displaybus`
+`busdisplay._displaybus`
================================================================================
Type aliases for Blinka
"""
from typing import Union
-import paralleldisplay
-from ._fourwire import FourWire
-from ._i2cdisplay import I2CDisplay
+import paralleldisplaybus
+import fourwire
+import i2cdisplaybus
__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_Blinka_Displayio.git"
-_DisplayBus = Union[FourWire, I2CDisplay, paralleldisplay.ParallelBus]
+_DisplayBus = Union[fourwire.FourWire, i2cdisplaybus.I2CDisplayBus, paralleldisplaybus.ParallelBus]
"""
import threading
from typing import Union
-from ._fourwire import FourWire
-from ._i2cdisplay import I2CDisplay
from ._bitmap import Bitmap
from ._colorspace import Colorspace
from ._colorconverter import ColorConverter
-from ._display import Display
-from ._epaperdisplay import EPaperDisplay
+from busdisplay import BusDisplay
+from epaperdisplay import EPaperDisplay
from ._group import Group
from ._ondiskbitmap import OnDiskBitmap
from ._palette import Palette
-from ._shape import Shape
from ._tilegrid import TileGrid
-from ._displaybus import _DisplayBus
+from busdisplay._displaybus import _DisplayBus
from ._constants import CIRCUITPY_DISPLAY_LIMIT
__version__ = "0.0.0+auto.0"
display_buses.clear()
-def allocate_display(new_display: Union[Display, EPaperDisplay]) -> None:
+def allocate_display(new_display: Union[BusDisplay, EPaperDisplay]) -> None:
"""Add a display to the displays pool and return the new display"""
if len(displays) >= CIRCUITPY_DISPLAY_LIMIT:
raise RuntimeError("Too many displays")
import time
import struct
from circuitpython_typing import WriteableBuffer, ReadableBuffer
-from paralleldisplay import ParallelBus
-from ._fourwire import FourWire
+from paralleldisplaybus import ParallelBus
+from fourwire import FourWire
from ._group import Group
-from ._i2cdisplay import I2CDisplay
+from i2cdisplaybus import I2CDisplayBus
from ._structs import ColorspaceStruct, TransformStruct
from ._area import Area
-from ._displaybus import _DisplayBus
+from busdisplay._displaybus import _DisplayBus
from ._helpers import bswap16
from ._constants import (
CHIP_SELECT_UNTOUCHED,
self.last_refresh = 0
if bus:
- if isinstance(bus, (FourWire, I2CDisplay, ParallelBus)):
+ if isinstance(bus, (FourWire, I2CDisplayBus, ParallelBus)):
self._bus_reset = bus.reset
self._bus_free = bus._free
self._begin_transaction = bus._begin_transaction
load times. These load times may result in frame tearing where only part of the image is
visible.
- It's easiest to use on a board with a built in display such as the `Hallowing M0 Express
- <https://www.adafruit.com/product/3900>`_.
-
.. code-block:: Python
import board
board.DISPLAY.auto_brightness = False
board.DISPLAY.brightness = 0
splash = displayio.Group()
- board.DISPLAY.show(splash)
+ board.DISPLAY.root_group = splash
odb = displayio.OnDiskBitmap(\'/sample.bmp\')
face = displayio.TileGrid(odb, pixel_shader=odb.pixel_shader)
+++ /dev/null
-# SPDX-FileCopyrightText: 2020 Melissa LeBlanc-Williams for Adafruit Industries
-#
-# SPDX-License-Identifier: MIT
-
-
-"""
-`displayio.shape`
-================================================================================
-
-displayio for Blinka
-
-**Software and Dependencies:**
-
-* Adafruit Blinka:
- https://github.com/adafruit/Adafruit_Blinka/releases
-
-* Author(s): Melissa LeBlanc-Williams
-
-"""
-
-from ._bitmap import Bitmap
-from ._area import Area
-from ._helpers import clamp
-
-__version__ = "0.0.0+auto.0"
-__repo__ = "https://github.com/adafruit/Adafruit_Blinka_displayio.git"
-
-
-class Shape(Bitmap):
- """Create a Shape object with the given fixed size. Each pixel is one bit and is stored
- by the column boundaries of the shape on each row. Each row’s boundary defaults to the
- full row.
- """
-
- def __init__(
- self, width: int, height: int, *, mirror_x: bool = False, mirror_y: bool = False
- ):
- """Create a Shape object with the given fixed size. Each pixel is one bit and is
- stored by the column boundaries of the shape on each row. Each row’s boundary
- defaults to the full row.
- """
- self._mirror_x = mirror_x
- self._mirror_y = mirror_y
- self._width = width
- self._height = height
- if self._mirror_x:
- width //= 2
- width += self._width % 2
- self._half_width = width
- if self._mirror_y:
- height //= 2
- height += self._height % 2
- self._half_height = height
- self._data = bytearray(height * 4)
- for i in range(height):
- self._data[2 * i] = 0
- self._data[2 * i + 1] = width
-
- self._dirty_area = Area(0, 0, width, height)
- super().__init__(width, height, 2)
-
- def set_boundary(self, y: int, start_x: int, end_x: int) -> None:
- """Loads pre-packed data into the given row."""
- max_y = self._height - 1
- if self._mirror_y:
- max_y = self._half_height - 1
- y = clamp(y, 0, max_y)
- max_x = self._width - 1
- if self._mirror_x:
- max_x = self._half_width - 1
- start_x = clamp(start_x, 0, max_x)
- end_x = clamp(end_x, 0, max_x)
-
- # find x-boundaries for updating based on current data and start_x, end_x, and mirror_x
- lower_x = min(start_x, self._data[2 * y])
-
- if self._mirror_x:
- upper_x = (
- self._width - lower_x + 1
- ) # dirty rectangles are treated with max value exclusive
- else:
- upper_x = max(
- end_x, self._data[2 * y + 1]
- ) # dirty rectangles are treated with max value exclusive
-
- # find y-boundaries based on y and mirror_y
- lower_y = y
-
- if self._mirror_y:
- upper_y = (
- self._height - lower_y + 1
- ) # dirty rectangles are treated with max value exclusive
- else:
- upper_y = y + 1 # dirty rectangles are treated with max value exclusive
-
- self._data[2 * y] = start_x # update the data array with the new boundaries
- self._data[2 * y + 1] = end_x
-
- if self._dirty_area.x1 == self._dirty_area.x2: # dirty region is empty
- self._dirty_area.x1 = lower_x
- self._dirty_area.x2 = upper_x
- self._dirty_area.y1 = lower_y
- self._dirty_area.y2 = upper_y
- else:
- self._dirty_area.x1 = min(lower_x, self._dirty_area.x1)
- self._dirty_area.x2 = max(upper_x, self._dirty_area.x2)
- self._dirty_area.y1 = min(lower_y, self._dirty_area.y1)
- self._dirty_area.y2 = max(upper_y, self._dirty_area.y2)
-
- def _get_pixel(self, x: int, y: int) -> int:
- if x >= self._width or x < 0 or y >= self._height or y < 0:
- return 0
- if self._mirror_x and x >= self._half_width:
- x = self._width - x - 1
- if self._mirror_y and y >= self._half_height:
- y = self._height - y - 1
- start_x = self._data[2 * y]
- end_x = self._data[2 * y + 1]
- if x < start_x or x >= end_x:
- return 0
- return 1
-
- def _finish_refresh(self):
- self._dirty_area.x1 = 0
- self._dirty_area.x2 = 0
-
- def _get_refresh_areas(self, areas: list[Area]) -> None:
- if self._dirty_area.x1 != self._dirty_area.x2:
- areas.append(self._dirty_area)
import microcontroller
from digitalio import DigitalInOut
from circuitpython_typing import ReadableBuffer
-from ._displaycore import _DisplayCore
-from ._group import Group, circuitpython_splash
-from ._colorconverter import ColorConverter
-from ._displaybus import _DisplayBus
-from ._area import Area
-from ._constants import (
+from displayio._displaycore import _DisplayCore
+from displayio._group import Group, circuitpython_splash
+from displayio._colorconverter import ColorConverter
+from busdisplay._displaybus import _DisplayBus
+from displayio._area import Area
+from displayio._constants import (
CHIP_SELECT_TOGGLE_EVERY_BYTE,
CHIP_SELECT_UNTOUCHED,
DISPLAY_COMMAND,
if highlight_color == 0x00 and write_color_ram_command != NO_COMMAND:
"""TODO: Clear"""
- self.show(circuitpython_splash)
+ self._set_root_group(circuitpython_splash)
def __new__(cls, *args, **kwargs):
- from . import ( # pylint: disable=import-outside-toplevel, cyclic-import
+ from ..displayio import ( # pylint: disable=import-outside-toplevel, cyclic-import
allocate_display,
)
allocate_display(display_instance)
return display_instance
- def show(self, group: Group) -> None:
- # pylint: disable=unnecessary-pass
- """
- .. note:: `show()` is deprecated and will be removed when CircuitPython 9.0.0
- is released. Use ``.root_group = group`` instead.
-
- Switches to displaying the given group of layers. When group is None, the default
- CircuitPython terminal will be shown (eventually).
- """
- if group is None:
- group = circuitpython_splash
- self._core.set_root_group(group)
+ def show(self, _group: Group) -> None: # pylint: disable=missing-function-docstring
+ raise AttributeError(".show(x) removed. Use .root_group = x")
def _set_root_group(self, root_group: Group) -> None:
ok = self._core.set_root_group(root_group)
import busio
import microcontroller
from circuitpython_typing import ReadableBuffer
-from ._constants import (
+from displayio._constants import (
CHIP_SELECT_TOGGLE_EVERY_BYTE,
CHIP_SELECT_UNTOUCHED,
DISPLAY_COMMAND,
import busio
import digitalio
from circuitpython_typing import ReadableBuffer
-from ._constants import CHIP_SELECT_UNTOUCHED, DISPLAY_COMMAND
+from displayio._constants import CHIP_SELECT_UNTOUCHED, DISPLAY_COMMAND
__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_Blinka_displayio.git"
-class I2CDisplay:
+class I2CDisplayBus:
"""Manage updating a display over I2C in the background while Python code runs.
It doesn’t handle display initialization.
"""
self._dev_addr = device_address
def __new__(cls, *args, **kwargs):
- from . import ( # pylint: disable=import-outside-toplevel, cyclic-import
+ from ..displayio import ( # pylint: disable=import-outside-toplevel, cyclic-import
allocate_display_bus,
)
keywords="adafruit blinka circuitpython micropython displayio lcd tft display pitft",
# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
- py_modules=["fontio", "terminalio", "paralleldisplay"],
- packages=["displayio", "vectorio"],
+ py_modules=["fontio", "terminalio"],
+ packages=["displayio", "vectorio", "paralleldisplaybus", "i2cdisplaybus", "fourwire", "busdisplay"],
)