Skip to content

Commit 73638a9

Browse files
authored
Merge pull request #2 from makermelissa/main
Add new bar displays
2 parents 66c33bb + e53e2cc commit 73638a9

File tree

4 files changed

+201
-1
lines changed

4 files changed

+201
-1
lines changed

adafruit_qualia/displays/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import time
1717
import busio
1818
import board
19+
import espidf
1920
import dotclockframebuffer
2021
from framebufferio import FramebufferDisplay
2122
from displayio import release_displays
@@ -55,7 +56,13 @@ def init(self, *, auto_refresh: bool = True):
5556
i2c.deinit()
5657
params = dict(board.TFT_PINS)
5758
params.update(self._timings)
58-
framebuffer = dotclockframebuffer.DotClockFramebuffer(**params)
59+
try:
60+
framebuffer = dotclockframebuffer.DotClockFramebuffer(**params)
61+
except espidf.IDFError as exc:
62+
raise RuntimeError(
63+
"Display dimension error. "
64+
"Make sure you are running the absolute latest version of CircuitPython."
65+
) from exc
5966
self.display = FramebufferDisplay(framebuffer, auto_refresh=auto_refresh)
6067

6168
def init_touch(self):
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
# SPDX-FileCopyrightText: Copyright (c) 2023 Melissa LeBlanc-Williams for Adafruit Industries
3+
#
4+
# SPDX-License-Identifier: MIT
5+
6+
"""
7+
`adafruit_qualia.displays.bar240x960`
8+
================================================================================
9+
10+
3.71" 240x960 Bar DotClock Display Class
11+
12+
13+
* Author(s): Melissa LeBlanc-Williams
14+
15+
Implementation Notes
16+
--------------------
17+
18+
**Hardware:**
19+
20+
* `Rectangle Bar RGB TTL TFT Display - 3.7" 240x960 No Touchscreen
21+
<https://www.adafruit.com/product/5799>`_
22+
23+
"""
24+
25+
from . import DotClockDisplay
26+
27+
28+
class Bar240x960(DotClockDisplay):
29+
"""HD371001C40 display driver"""
30+
31+
def __init__(self):
32+
super().__init__()
33+
self._init_sequence = bytes(
34+
(
35+
b"\xff\x05w\x01\x00\x00\x13"
36+
b"\xef\x01\x08"
37+
b"\xff\x05w\x01\x00\x00\x10"
38+
b"\xc0\x02w\x00"
39+
b"\xc1\x02\x11\x0c"
40+
b"\xc2\x02\x07\x02"
41+
b"\xcc\x010"
42+
b"\xb0\x10\x06\xcf\x14\x0c\x0f\x03\x00\n\x07\x1b\x03\x12\x10%6\x1e"
43+
b"\xb1\x10\x0c\xd4\x18\x0c\x0e\x06\x03\x06\x08#\x06\x12\x100/\x1f"
44+
b"\xff\x05w\x01\x00\x00\x11"
45+
b"\xb0\x01s"
46+
b"\xb1\x01|"
47+
b"\xb2\x01\x83"
48+
b"\xb3\x01\x80"
49+
b"\xb5\x01I"
50+
b"\xb7\x01\x87"
51+
b"\xb8\x013"
52+
b"\xb9\x02\x10\x1f"
53+
b"\xbb\x01\x03"
54+
b"\xc1\x01\x08"
55+
b"\xc2\x01\x08"
56+
b"\xd0\x01\x88"
57+
b"\xe0\x06\x00\x00\x02\x00\x00\x0c"
58+
b"\xe1\x0b\x05\x96\x07\x96\x06\x96\x08\x96\x00DD"
59+
b"\xe2\x0c\x00\x00\x03\x03\x00\x00\x02\x00\x00\x00\x02\x00"
60+
b"\xe3\x04\x00\x0033"
61+
b"\xe4\x02DD"
62+
b"\xe5\x10\r\xd4(\x8c\x0f\xd6(\x8c\t\xd0(\x8c\x0b\xd2(\x8c"
63+
b"\xe6\x04\x00\x0033"
64+
b"\xe7\x02DD"
65+
b"\xe8\x10\x0e\xd5(\x8c\x10\xd7(\x8c\n\xd1(\x8c\x0c\xd3(\x8c"
66+
b"\xeb\x06\x00\x01\xe4\xe4D\x00"
67+
b"\xed\x10\xf3\xc1\xba\x0ffwDUUDwf\xf0\xab\x1c?"
68+
b"\xef\x06\x10\r\x04\x08?\x1f"
69+
b"\xff\x05w\x01\x00\x00\x13"
70+
b"\xe8\x02\x00\x0e"
71+
b"\x11\x80x"
72+
b"\xe8\x82\x00\x0c\n"
73+
b"\xe8\x02@\x00"
74+
b"\xff\x05w\x01\x00\x00\x00"
75+
b"6\x01\x00"
76+
b":\x01f"
77+
b")\x80\x14"
78+
b"\xff\x05w\x01\x00\x00\x10"
79+
b"\xe5\x02\x00\x00"
80+
)
81+
)
82+
83+
self._timings = {
84+
"frequency": 16000000,
85+
"width": 240,
86+
"height": 960,
87+
"overscan_left": 120,
88+
"hsync_pulse_width": 8,
89+
"hsync_back_porch": 20,
90+
"hsync_front_porch": 20,
91+
"hsync_idle_low": False,
92+
"vsync_pulse_width": 8,
93+
"vsync_back_porch": 20,
94+
"vsync_front_porch": 20,
95+
"vsync_idle_low": False,
96+
"pclk_active_high": True,
97+
"pclk_idle_high": False,
98+
"de_idle_high": False,
99+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
# SPDX-FileCopyrightText: Copyright (c) 2023 Melissa LeBlanc-Williams for Adafruit Industries
3+
#
4+
# SPDX-License-Identifier: MIT
5+
6+
"""
7+
`adafruit_qualia.displays.bar320x960`
8+
================================================================================
9+
10+
4.58" 320x960 Bar DotClock Display Class
11+
12+
13+
* Author(s): Melissa LeBlanc-Williams
14+
15+
Implementation Notes
16+
--------------------
17+
18+
**Hardware:**
19+
20+
* `Rectangle Bar RGB TTL TFT Display - 4.58" 320x960 No Touchscreen
21+
<https://www.adafruit.com/product/5805>`_
22+
23+
"""
24+
25+
from . import DotClockDisplay
26+
27+
28+
class Bar320x960(DotClockDisplay):
29+
"""HD458002C40 display driver"""
30+
31+
def __init__(self):
32+
super().__init__()
33+
self._init_sequence = bytes(
34+
(
35+
b"\xff\x05w\x01\x00\x00\x13"
36+
b"\xef\x01\x08"
37+
b"\xff\x05w\x01\x00\x00\x10"
38+
b"\xc0\x02w\x00"
39+
b"\xc1\x02\t\x08"
40+
b"\xc2\x02\x01\x02"
41+
b"\xc3\x01\x02"
42+
b"\xcc\x01\x10"
43+
b"\xb0\x10@\x14Y\x10\x12\x08\x03\t\x05\x1e\x05\x14\x10h3\x15"
44+
b"\xb1\x10@\x08S\t\x11\t\x02\x07\t\x1a\x04\x12\x12d))"
45+
b"\xff\x05w\x01\x00\x00\x11"
46+
b"\xb0\x01m"
47+
b"\xb1\x01\x1d"
48+
b"\xb2\x01\x87"
49+
b"\xb3\x01\x80"
50+
b"\xb5\x01I"
51+
b"\xb7\x01\x85"
52+
b"\xb8\x01 "
53+
b"\xc1\x01x"
54+
b"\xc2\x01x"
55+
b"\xd0\x01\x88"
56+
b"\xe0\x03\x00\x00\x02"
57+
b"\xe1\x0b\x02\x8c\x00\x00\x03\x8c\x00\x00\x0033"
58+
b"\xe2\r3333\xc9<\x00\x00\xca<\x00\x00\x00"
59+
b"\xe3\x04\x00\x0033"
60+
b"\xe4\x02DD"
61+
b"\xe5\x10\x05\xcd\x82\x82\x01\xc9\x82\x82\x07\xcf\x82\x82\x03\xcb\x82\x82"
62+
b"\xe6\x04\x00\x0033"
63+
b"\xe7\x02DD"
64+
b"\xe8\x10\x06\xce\x82\x82\x02\xca\x82\x82\x08\xd0\x82\x82\x04\xcc\x82\x82"
65+
b"\xeb\x07\x08\x01\xe4\xe4\x88\x00@"
66+
b"\xec\x03\x00\x00\x00"
67+
b"\xed\x10\xff\xf0\x07eO\xfc\xc2/\xf2,\xcf\xf4Vp\x0f\xff"
68+
b"\xef\x06\x10\r\x04\x08?\x1f"
69+
b"\xff\x05w\x01\x00\x00\x00"
70+
b"\x11\x80x"
71+
b"5\x01\x00"
72+
b":\x81fd"
73+
b")\x00"
74+
)
75+
)
76+
77+
self._timings = {
78+
"frequency": 16000000,
79+
"width": 320,
80+
"height": 960,
81+
"overscan_left": 80,
82+
"hsync_pulse_width": 10,
83+
"hsync_front_porch": 30,
84+
"hsync_back_porch": 50,
85+
"hsync_idle_low": False,
86+
"vsync_pulse_width": 2,
87+
"vsync_front_porch": 15,
88+
"vsync_back_porch": 17,
89+
"vsync_idle_low": False,
90+
"pclk_active_high": False,
91+
"pclk_idle_high": False,
92+
"de_idle_high": False,
93+
}

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"wifi",
3636
"socketpool",
3737
"bitmaptools",
38+
"espidf",
3839
]
3940
autodoc_preserve_defaults = True
4041

0 commit comments

Comments
 (0)