Skip to content
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

A work-around for using byte-string as the data #138

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ bundles
dist
**/*.egg-info
.vscode
venv
.venv
8 changes: 7 additions & 1 deletion i2cdisplaybus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,14 @@ def send(self, command: int, data: ReadableBuffer) -> None:
such as vertical scroll, set via ``send`` may or may not be reset once the code is
done.
"""

# prepend the command to the data buffer
buffer = bytearray(len(data) + 1)
buffer[0] = command & 0xFF
buffer[1:] = data

self._begin_transaction()
self._send(DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, bytes([command] + data))
self._send(DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, buffer)
self._end_transaction()

def _send(
Expand Down
Loading