Skip to content

Commit e89ad47

Browse files
authored
Merge pull request #26 from makermelissa/master
Add border control parameter
2 parents 3a6ce93 + 39080d7 commit e89ad47

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

adafruit_il0373.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
b"\x06\x03\x17\x17\x17" # booster soft start
5151
b"\x04\x80\xc8" # power on and wait 200 ms
5252
b"\x00\x01\x2f" # panel setting. Further filled in below.
53-
b"\x50\x01\x97" # CDI setting
53+
b"\x50\x01\x17" # CDI setting
5454
b"\x30\x01\x3C" # PLL set to 50 Hz (M = 7, N = 4)
5555
b"\x61\x03\x00\x00\x00" # Resolution
5656
b"\x82\x81\x12\x32" # VCM DC and delay 50ms
@@ -112,6 +112,8 @@ class IL0373(displayio.EPaperDisplay):
112112
113113
:param bus: The data bus the display is on
114114
:param bool swap_rams: Color and black rams/commands are swapped
115+
:param border: If true, black border is drawn, if false white.
116+
If None, previous color remains.
115117
:param \**kwargs:
116118
See below
117119
@@ -128,12 +130,11 @@ class IL0373(displayio.EPaperDisplay):
128130
Invert black bit values
129131
"""
130132

131-
def __init__(self, bus, swap_rams=False, **kwargs):
133+
def __init__(self, bus, swap_rams=False, border=False, **kwargs):
132134
if kwargs.get("grayscale", False):
133135
start_sequence = bytearray(_GRAYSCALE_START_SEQUENCE)
134136
else:
135137
start_sequence = bytearray(_START_SEQUENCE)
136-
137138
width = kwargs["width"]
138139
height = kwargs["height"]
139140
if "rotation" in kwargs and kwargs["rotation"] % 180 != 0:
@@ -151,6 +152,11 @@ def __init__(self, bus, swap_rams=False, **kwargs):
151152
write_color_ram_command = 0x13
152153
color_bits_inverted = kwargs.pop("color_bits_inverted", True)
153154
black_bits_inverted = kwargs.pop("black_bits_inverted", False)
155+
if border is None:
156+
start_sequence[20] |= 0b11 << 6 # Border remains unchanged
157+
elif not border:
158+
start_sequence[20] |= 0b01 << 6 # Border is White
159+
154160
if "highlight_color" not in kwargs:
155161
start_sequence[17] |= 1 << 4 # Set BWR to only do black and white.
156162

0 commit comments

Comments
 (0)