Skip to content

Commit a7c4f8b

Browse files
committed
A work-around for using byte-string as the data
Fixes #137 -- a byte-string is not representable as a `list` for adding, so this just re-wraps the iterable in a "real" `list`
1 parent 06038e9 commit a7c4f8b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ bundles
1616
dist
1717
**/*.egg-info
1818
.vscode
19+
venv
20+
.venv

i2cdisplaybus/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ def send(self, command: int, data: ReadableBuffer) -> None:
8787
done.
8888
"""
8989
self._begin_transaction()
90-
self._send(DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, bytes([command] + data))
90+
# re-wrap in case of byte-string
91+
buffer = list(data) if isinstance(data, bytes) else data
92+
self._send(DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, bytes([command] + buffer))
9193
self._end_transaction()
9294

9395
def _send(

0 commit comments

Comments
 (0)