Merge pull request #11 from dhalbert/buffered-writes

Write in chunks of 20 bytes or less
This commit is contained in:
Dan Halbert 2019-04-23 08:32:24 -04:00 committed by GitHub
commit 04c84be2a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -125,4 +125,8 @@ class UARTServer:
def write(self, buf): def write(self, buf):
"""Write a buffer of bytes.""" """Write a buffer of bytes."""
self._nus_tx_char.value = buf # We can only write 20 bytes at a time.
offset = 0
while offset < len(buf):
self._nus_tx_char.value = buf[offset:offset+20]
offset += 20