Skip to content

Commit b2ee837

Browse files
fix bitbang port value exceeding 8 bits
1 parent 183b94e commit b2ee837

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/pylibftdi/bitbang.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ def port(self):
158158

159159
@port.setter
160160
def port(self, value):
161+
# restrict to a single byte
162+
value &= 0xFF
161163
self._latch = value
162164
if self.sync:
163165
self.flush_output()
164-
return super().write(chr(value))
166+
return super().write(value.to_bytes())

0 commit comments

Comments
 (0)