From 4c19f543374e6f7f78ccc7a5d7994e0d8639b164 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 6 Dec 2023 14:27:14 -0800 Subject: [PATCH 1/3] Add new bar displays --- adafruit_qualia/displays/__init__.py | 9 ++- adafruit_qualia/displays/bar240x960.py | 99 ++++++++++++++++++++++++++ adafruit_qualia/displays/bar320x960.py | 93 ++++++++++++++++++++++++ 3 files changed, 200 insertions(+), 1 deletion(-) create mode 100755 adafruit_qualia/displays/bar240x960.py create mode 100755 adafruit_qualia/displays/bar320x960.py diff --git a/adafruit_qualia/displays/__init__.py b/adafruit_qualia/displays/__init__.py index 35ac699..310d88c 100755 --- a/adafruit_qualia/displays/__init__.py +++ b/adafruit_qualia/displays/__init__.py @@ -16,6 +16,7 @@ import time import busio import board +import espidf import dotclockframebuffer from framebufferio import FramebufferDisplay from displayio import release_displays @@ -55,7 +56,13 @@ def init(self, *, auto_refresh: bool = True): i2c.deinit() params = dict(board.TFT_PINS) params.update(self._timings) - framebuffer = dotclockframebuffer.DotClockFramebuffer(**params) + try: + framebuffer = dotclockframebuffer.DotClockFramebuffer(**params) + except espidf.IDFError as exc: + raise RuntimeError( + "Display dimension error. " + "Make sure you are running the absolute latest version of CircuitPython." + ) from exc self.display = FramebufferDisplay(framebuffer, auto_refresh=auto_refresh) def init_touch(self): diff --git a/adafruit_qualia/displays/bar240x960.py b/adafruit_qualia/displays/bar240x960.py new file mode 100755 index 0000000..6bda4e5 --- /dev/null +++ b/adafruit_qualia/displays/bar240x960.py @@ -0,0 +1,99 @@ +# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2023 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +""" +`adafruit_qualia.displays.bar240x960` +================================================================================ + +3.71" 240x960 Bar DotClock Display Class + + +* Author(s): Melissa LeBlanc-Williams + +Implementation Notes +-------------------- + +**Hardware:** + +* `Rectangle Bar RGB TTL TFT Display - 3.7" 240x960 No Touchscreen + `_ + +""" + +from . import DotClockDisplay + + +class Bar240x960(DotClockDisplay): + """HD371001C40 display driver""" + + def __init__(self): + super().__init__() + self._init_sequence = bytes( + ( + b'\xff\x05w\x01\x00\x00\x13' + b'\xef\x01\x08' + b'\xff\x05w\x01\x00\x00\x10' + b'\xc0\x02w\x00' + b'\xc1\x02\x11\x0c' + b'\xc2\x02\x07\x02' + b'\xcc\x010' + b'\xb0\x10\x06\xcf\x14\x0c\x0f\x03\x00\n\x07\x1b\x03\x12\x10%6\x1e' + b'\xb1\x10\x0c\xd4\x18\x0c\x0e\x06\x03\x06\x08#\x06\x12\x100/\x1f' + b'\xff\x05w\x01\x00\x00\x11' + b'\xb0\x01s' + b'\xb1\x01|' + b'\xb2\x01\x83' + b'\xb3\x01\x80' + b'\xb5\x01I' + b'\xb7\x01\x87' + b'\xb8\x013' + b'\xb9\x02\x10\x1f' + b'\xbb\x01\x03' + b'\xc1\x01\x08' + b'\xc2\x01\x08' + b'\xd0\x01\x88' + b'\xe0\x06\x00\x00\x02\x00\x00\x0c' + b'\xe1\x0b\x05\x96\x07\x96\x06\x96\x08\x96\x00DD' + b'\xe2\x0c\x00\x00\x03\x03\x00\x00\x02\x00\x00\x00\x02\x00' + b'\xe3\x04\x00\x0033' + b'\xe4\x02DD' + b'\xe5\x10\r\xd4(\x8c\x0f\xd6(\x8c\t\xd0(\x8c\x0b\xd2(\x8c' + b'\xe6\x04\x00\x0033' + b'\xe7\x02DD' + b'\xe8\x10\x0e\xd5(\x8c\x10\xd7(\x8c\n\xd1(\x8c\x0c\xd3(\x8c' + b'\xeb\x06\x00\x01\xe4\xe4D\x00' + b'\xed\x10\xf3\xc1\xba\x0ffwDUUDwf\xf0\xab\x1c?' + b'\xef\x06\x10\r\x04\x08?\x1f' + b'\xff\x05w\x01\x00\x00\x13' + b'\xe8\x02\x00\x0e' + b'\x11\x80x' + b'\xe8\x82\x00\x0c\n' + b'\xe8\x02@\x00' + b'\xff\x05w\x01\x00\x00\x00' + b'6\x01\x00' + b':\x01f' + b')\x80\x14' + b'\xff\x05w\x01\x00\x00\x10' + b'\xe5\x02\x00\x00' + ) + ) + + self._timings = { + "frequency": 16000000, + "width": 240, + "height": 960, + "overscan_left": 120, + "hsync_pulse_width": 8, + "hsync_back_porch": 20, + "hsync_front_porch": 20, + "hsync_idle_low": False, + "vsync_pulse_width": 8, + "vsync_back_porch": 20, + "vsync_front_porch": 20, + "vsync_idle_low": False, + "pclk_active_high": True, + "pclk_idle_high": False, + "de_idle_high": False, + } diff --git a/adafruit_qualia/displays/bar320x960.py b/adafruit_qualia/displays/bar320x960.py new file mode 100755 index 0000000..5c16f09 --- /dev/null +++ b/adafruit_qualia/displays/bar320x960.py @@ -0,0 +1,93 @@ +# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2023 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +""" +`adafruit_qualia.displays.bar320x960` +================================================================================ + +4.58" 320x960 Bar DotClock Display Class + + +* Author(s): Melissa LeBlanc-Williams + +Implementation Notes +-------------------- + +**Hardware:** + +* `Rectangle Bar RGB TTL TFT Display - 4.58" 320x960 No Touchscreen + `_ + +""" + +from . import DotClockDisplay + + +class Bar320x960(DotClockDisplay): + """HD458002C40 display driver""" + + def __init__(self): + super().__init__() + self._init_sequence = bytes( + ( + b'\xff\x05w\x01\x00\x00\x13' + b'\xef\x01\x08' + b'\xff\x05w\x01\x00\x00\x10' + b'\xc0\x02w\x00' + b'\xc1\x02\t\x08' + b'\xc2\x02\x01\x02' + b'\xc3\x01\x02' + b'\xcc\x01\x10' + b'\xb0\x10@\x14Y\x10\x12\x08\x03\t\x05\x1e\x05\x14\x10h3\x15' + b'\xb1\x10@\x08S\t\x11\t\x02\x07\t\x1a\x04\x12\x12d))' + b'\xff\x05w\x01\x00\x00\x11' + b'\xb0\x01m' + b'\xb1\x01\x1d' + b'\xb2\x01\x87' + b'\xb3\x01\x80' + b'\xb5\x01I' + b'\xb7\x01\x85' + b'\xb8\x01 ' + b'\xc1\x01x' + b'\xc2\x01x' + b'\xd0\x01\x88' + b'\xe0\x03\x00\x00\x02' + b'\xe1\x0b\x02\x8c\x00\x00\x03\x8c\x00\x00\x0033' + b'\xe2\r3333\xc9<\x00\x00\xca<\x00\x00\x00' + b'\xe3\x04\x00\x0033' + b'\xe4\x02DD' + b'\xe5\x10\x05\xcd\x82\x82\x01\xc9\x82\x82\x07\xcf\x82\x82\x03\xcb\x82\x82' + b'\xe6\x04\x00\x0033' + b'\xe7\x02DD' + b'\xe8\x10\x06\xce\x82\x82\x02\xca\x82\x82\x08\xd0\x82\x82\x04\xcc\x82\x82' + b'\xeb\x07\x08\x01\xe4\xe4\x88\x00@' + b'\xec\x03\x00\x00\x00' + b'\xed\x10\xff\xf0\x07eO\xfc\xc2/\xf2,\xcf\xf4Vp\x0f\xff' + b'\xef\x06\x10\r\x04\x08?\x1f' + b'\xff\x05w\x01\x00\x00\x00' + b'\x11\x80x' + b'5\x01\x00' + b':\x81fd' + b')\x00' + ) + ) + + self._timings = { + "frequency": 16000000, + "width": 320, + "height": 960, + "overscan_left": 80, + "hsync_pulse_width": 10, + "hsync_front_porch": 30, + "hsync_back_porch": 50, + "hsync_idle_low": False, + "vsync_pulse_width": 2, + "vsync_front_porch": 15, + "vsync_back_porch": 17, + "vsync_idle_low": False, + "pclk_active_high": False, + "pclk_idle_high": False, + "de_idle_high": False, + } From 95b4a6b6e751ba5843432dcb70b1b82369f711e1 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 6 Dec 2023 14:44:47 -0800 Subject: [PATCH 2/3] Re-run pre-commit after upgrading --- adafruit_qualia/displays/bar240x960.py | 90 +++++++++++++------------- adafruit_qualia/displays/bar320x960.py | 78 +++++++++++----------- 2 files changed, 84 insertions(+), 84 deletions(-) diff --git a/adafruit_qualia/displays/bar240x960.py b/adafruit_qualia/displays/bar240x960.py index 6bda4e5..02b57e4 100755 --- a/adafruit_qualia/displays/bar240x960.py +++ b/adafruit_qualia/displays/bar240x960.py @@ -32,51 +32,51 @@ def __init__(self): super().__init__() self._init_sequence = bytes( ( - b'\xff\x05w\x01\x00\x00\x13' - b'\xef\x01\x08' - b'\xff\x05w\x01\x00\x00\x10' - b'\xc0\x02w\x00' - b'\xc1\x02\x11\x0c' - b'\xc2\x02\x07\x02' - b'\xcc\x010' - b'\xb0\x10\x06\xcf\x14\x0c\x0f\x03\x00\n\x07\x1b\x03\x12\x10%6\x1e' - b'\xb1\x10\x0c\xd4\x18\x0c\x0e\x06\x03\x06\x08#\x06\x12\x100/\x1f' - b'\xff\x05w\x01\x00\x00\x11' - b'\xb0\x01s' - b'\xb1\x01|' - b'\xb2\x01\x83' - b'\xb3\x01\x80' - b'\xb5\x01I' - b'\xb7\x01\x87' - b'\xb8\x013' - b'\xb9\x02\x10\x1f' - b'\xbb\x01\x03' - b'\xc1\x01\x08' - b'\xc2\x01\x08' - b'\xd0\x01\x88' - b'\xe0\x06\x00\x00\x02\x00\x00\x0c' - b'\xe1\x0b\x05\x96\x07\x96\x06\x96\x08\x96\x00DD' - b'\xe2\x0c\x00\x00\x03\x03\x00\x00\x02\x00\x00\x00\x02\x00' - b'\xe3\x04\x00\x0033' - b'\xe4\x02DD' - b'\xe5\x10\r\xd4(\x8c\x0f\xd6(\x8c\t\xd0(\x8c\x0b\xd2(\x8c' - b'\xe6\x04\x00\x0033' - b'\xe7\x02DD' - b'\xe8\x10\x0e\xd5(\x8c\x10\xd7(\x8c\n\xd1(\x8c\x0c\xd3(\x8c' - b'\xeb\x06\x00\x01\xe4\xe4D\x00' - b'\xed\x10\xf3\xc1\xba\x0ffwDUUDwf\xf0\xab\x1c?' - b'\xef\x06\x10\r\x04\x08?\x1f' - b'\xff\x05w\x01\x00\x00\x13' - b'\xe8\x02\x00\x0e' - b'\x11\x80x' - b'\xe8\x82\x00\x0c\n' - b'\xe8\x02@\x00' - b'\xff\x05w\x01\x00\x00\x00' - b'6\x01\x00' - b':\x01f' - b')\x80\x14' - b'\xff\x05w\x01\x00\x00\x10' - b'\xe5\x02\x00\x00' + b"\xff\x05w\x01\x00\x00\x13" + b"\xef\x01\x08" + b"\xff\x05w\x01\x00\x00\x10" + b"\xc0\x02w\x00" + b"\xc1\x02\x11\x0c" + b"\xc2\x02\x07\x02" + b"\xcc\x010" + b"\xb0\x10\x06\xcf\x14\x0c\x0f\x03\x00\n\x07\x1b\x03\x12\x10%6\x1e" + b"\xb1\x10\x0c\xd4\x18\x0c\x0e\x06\x03\x06\x08#\x06\x12\x100/\x1f" + b"\xff\x05w\x01\x00\x00\x11" + b"\xb0\x01s" + b"\xb1\x01|" + b"\xb2\x01\x83" + b"\xb3\x01\x80" + b"\xb5\x01I" + b"\xb7\x01\x87" + b"\xb8\x013" + b"\xb9\x02\x10\x1f" + b"\xbb\x01\x03" + b"\xc1\x01\x08" + b"\xc2\x01\x08" + b"\xd0\x01\x88" + b"\xe0\x06\x00\x00\x02\x00\x00\x0c" + b"\xe1\x0b\x05\x96\x07\x96\x06\x96\x08\x96\x00DD" + b"\xe2\x0c\x00\x00\x03\x03\x00\x00\x02\x00\x00\x00\x02\x00" + b"\xe3\x04\x00\x0033" + b"\xe4\x02DD" + b"\xe5\x10\r\xd4(\x8c\x0f\xd6(\x8c\t\xd0(\x8c\x0b\xd2(\x8c" + b"\xe6\x04\x00\x0033" + b"\xe7\x02DD" + b"\xe8\x10\x0e\xd5(\x8c\x10\xd7(\x8c\n\xd1(\x8c\x0c\xd3(\x8c" + b"\xeb\x06\x00\x01\xe4\xe4D\x00" + b"\xed\x10\xf3\xc1\xba\x0ffwDUUDwf\xf0\xab\x1c?" + b"\xef\x06\x10\r\x04\x08?\x1f" + b"\xff\x05w\x01\x00\x00\x13" + b"\xe8\x02\x00\x0e" + b"\x11\x80x" + b"\xe8\x82\x00\x0c\n" + b"\xe8\x02@\x00" + b"\xff\x05w\x01\x00\x00\x00" + b"6\x01\x00" + b":\x01f" + b")\x80\x14" + b"\xff\x05w\x01\x00\x00\x10" + b"\xe5\x02\x00\x00" ) ) diff --git a/adafruit_qualia/displays/bar320x960.py b/adafruit_qualia/displays/bar320x960.py index 5c16f09..66bbde0 100755 --- a/adafruit_qualia/displays/bar320x960.py +++ b/adafruit_qualia/displays/bar320x960.py @@ -32,45 +32,45 @@ def __init__(self): super().__init__() self._init_sequence = bytes( ( - b'\xff\x05w\x01\x00\x00\x13' - b'\xef\x01\x08' - b'\xff\x05w\x01\x00\x00\x10' - b'\xc0\x02w\x00' - b'\xc1\x02\t\x08' - b'\xc2\x02\x01\x02' - b'\xc3\x01\x02' - b'\xcc\x01\x10' - b'\xb0\x10@\x14Y\x10\x12\x08\x03\t\x05\x1e\x05\x14\x10h3\x15' - b'\xb1\x10@\x08S\t\x11\t\x02\x07\t\x1a\x04\x12\x12d))' - b'\xff\x05w\x01\x00\x00\x11' - b'\xb0\x01m' - b'\xb1\x01\x1d' - b'\xb2\x01\x87' - b'\xb3\x01\x80' - b'\xb5\x01I' - b'\xb7\x01\x85' - b'\xb8\x01 ' - b'\xc1\x01x' - b'\xc2\x01x' - b'\xd0\x01\x88' - b'\xe0\x03\x00\x00\x02' - b'\xe1\x0b\x02\x8c\x00\x00\x03\x8c\x00\x00\x0033' - b'\xe2\r3333\xc9<\x00\x00\xca<\x00\x00\x00' - b'\xe3\x04\x00\x0033' - b'\xe4\x02DD' - b'\xe5\x10\x05\xcd\x82\x82\x01\xc9\x82\x82\x07\xcf\x82\x82\x03\xcb\x82\x82' - b'\xe6\x04\x00\x0033' - b'\xe7\x02DD' - b'\xe8\x10\x06\xce\x82\x82\x02\xca\x82\x82\x08\xd0\x82\x82\x04\xcc\x82\x82' - b'\xeb\x07\x08\x01\xe4\xe4\x88\x00@' - b'\xec\x03\x00\x00\x00' - b'\xed\x10\xff\xf0\x07eO\xfc\xc2/\xf2,\xcf\xf4Vp\x0f\xff' - b'\xef\x06\x10\r\x04\x08?\x1f' - b'\xff\x05w\x01\x00\x00\x00' - b'\x11\x80x' - b'5\x01\x00' - b':\x81fd' - b')\x00' + b"\xff\x05w\x01\x00\x00\x13" + b"\xef\x01\x08" + b"\xff\x05w\x01\x00\x00\x10" + b"\xc0\x02w\x00" + b"\xc1\x02\t\x08" + b"\xc2\x02\x01\x02" + b"\xc3\x01\x02" + b"\xcc\x01\x10" + b"\xb0\x10@\x14Y\x10\x12\x08\x03\t\x05\x1e\x05\x14\x10h3\x15" + b"\xb1\x10@\x08S\t\x11\t\x02\x07\t\x1a\x04\x12\x12d))" + b"\xff\x05w\x01\x00\x00\x11" + b"\xb0\x01m" + b"\xb1\x01\x1d" + b"\xb2\x01\x87" + b"\xb3\x01\x80" + b"\xb5\x01I" + b"\xb7\x01\x85" + b"\xb8\x01 " + b"\xc1\x01x" + b"\xc2\x01x" + b"\xd0\x01\x88" + b"\xe0\x03\x00\x00\x02" + b"\xe1\x0b\x02\x8c\x00\x00\x03\x8c\x00\x00\x0033" + b"\xe2\r3333\xc9<\x00\x00\xca<\x00\x00\x00" + b"\xe3\x04\x00\x0033" + b"\xe4\x02DD" + b"\xe5\x10\x05\xcd\x82\x82\x01\xc9\x82\x82\x07\xcf\x82\x82\x03\xcb\x82\x82" + b"\xe6\x04\x00\x0033" + b"\xe7\x02DD" + b"\xe8\x10\x06\xce\x82\x82\x02\xca\x82\x82\x08\xd0\x82\x82\x04\xcc\x82\x82" + b"\xeb\x07\x08\x01\xe4\xe4\x88\x00@" + b"\xec\x03\x00\x00\x00" + b"\xed\x10\xff\xf0\x07eO\xfc\xc2/\xf2,\xcf\xf4Vp\x0f\xff" + b"\xef\x06\x10\r\x04\x08?\x1f" + b"\xff\x05w\x01\x00\x00\x00" + b"\x11\x80x" + b"5\x01\x00" + b":\x81fd" + b")\x00" ) ) From e53e2cc9d4c554d33889170f6d7bcb86dd364c71 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 6 Dec 2023 14:53:59 -0800 Subject: [PATCH 3/3] Add espidf to autodoc_mock_imports --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index 8cdf443..19493d8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -35,6 +35,7 @@ "wifi", "socketpool", "bitmaptools", + "espidf", ] autodoc_preserve_defaults = True