Skip to content

Fixed issue with passing inverted bits keyword arguments #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions adafruit_il0373.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,25 @@
)
# pylint: disable=too-few-public-methods
class IL0373(displayio.EPaperDisplay):
"""IL0373 driver"""
r"""IL0373 driver

:param bus: The data bus the display is on
:param bool swap_rams: Color and black rams/commands are swapped
:param \**kwargs:
See below

:Keyword Arguments:
* *width* (``int``) --
Display width
* *height* (``int``) --
Display height
* *rotation* (``int``) --
Display rotation
* *color_bits_inverted* (``bool``) --
Invert color bit values
* *black_bits_inverted* (``bool``) --
Invert black bit values
"""
def __init__(self, bus, swap_rams=False, **kwargs):
start_sequence = bytearray(_START_SEQUENCE)

Expand All @@ -83,15 +101,15 @@ def __init__(self, bus, swap_rams=False, **kwargs):
start_sequence[27] = (height >> 8) & 0xFF
start_sequence[28] = height & 0xFF
if swap_rams:
color_bits_inverted = kwargs.get("black_bits_inverted", False)
color_bits_inverted = kwargs.pop("color_bits_inverted", False)
write_color_ram_command = 0x10
black_bits_inverted = kwargs.get("color_bits_inverted", True)
black_bits_inverted = kwargs.pop("black_bits_inverted", True)
write_black_ram_command = 0x13
else:
write_black_ram_command = 0x10
write_color_ram_command = 0x13
color_bits_inverted = kwargs.get("color_bits_inverted", True)
black_bits_inverted = kwargs.get("black_bits_inverted", False)
color_bits_inverted = kwargs.pop("color_bits_inverted", True)
black_bits_inverted = kwargs.pop("black_bits_inverted", False)
super().__init__(bus, start_sequence, _STOP_SEQUENCE, **kwargs,
ram_width=160, ram_height=296,
busy_state=False,
Expand Down