Skip to content

Commit 01ce815

Browse files
authored
Merge pull request #7 from bmeisels/kwargs_fix
Fixed issue with passing inverted bits keyword arguments
2 parents a16f3bd + 6fe04eb commit 01ce815

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

adafruit_il0373.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,25 @@
6969
)
7070
# pylint: disable=too-few-public-methods
7171
class IL0373(displayio.EPaperDisplay):
72-
"""IL0373 driver"""
72+
r"""IL0373 driver
73+
74+
:param bus: The data bus the display is on
75+
:param bool swap_rams: Color and black rams/commands are swapped
76+
:param \**kwargs:
77+
See below
78+
79+
:Keyword Arguments:
80+
* *width* (``int``) --
81+
Display width
82+
* *height* (``int``) --
83+
Display height
84+
* *rotation* (``int``) --
85+
Display rotation
86+
* *color_bits_inverted* (``bool``) --
87+
Invert color bit values
88+
* *black_bits_inverted* (``bool``) --
89+
Invert black bit values
90+
"""
7391
def __init__(self, bus, swap_rams=False, **kwargs):
7492
start_sequence = bytearray(_START_SEQUENCE)
7593

@@ -83,15 +101,15 @@ def __init__(self, bus, swap_rams=False, **kwargs):
83101
start_sequence[27] = (height >> 8) & 0xFF
84102
start_sequence[28] = height & 0xFF
85103
if swap_rams:
86-
color_bits_inverted = kwargs.get("black_bits_inverted", False)
104+
color_bits_inverted = kwargs.pop("color_bits_inverted", False)
87105
write_color_ram_command = 0x10
88-
black_bits_inverted = kwargs.get("color_bits_inverted", True)
106+
black_bits_inverted = kwargs.pop("black_bits_inverted", True)
89107
write_black_ram_command = 0x13
90108
else:
91109
write_black_ram_command = 0x10
92110
write_color_ram_command = 0x13
93-
color_bits_inverted = kwargs.get("color_bits_inverted", True)
94-
black_bits_inverted = kwargs.get("black_bits_inverted", False)
111+
color_bits_inverted = kwargs.pop("color_bits_inverted", True)
112+
black_bits_inverted = kwargs.pop("black_bits_inverted", False)
95113
super().__init__(bus, start_sequence, _STOP_SEQUENCE, **kwargs,
96114
ram_width=160, ram_height=296,
97115
busy_state=False,

0 commit comments

Comments
 (0)