Skip to content

Commit 04c84be

Browse files
authored
Merge pull request #11 from dhalbert/buffered-writes
Write in chunks of 20 bytes or less
2 parents 52f7488 + 1de7ea4 commit 04c84be

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

adafruit_ble/uart.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,8 @@ def reset_input_buffer(self):
125125

126126
def write(self, buf):
127127
"""Write a buffer of bytes."""
128-
self._nus_tx_char.value = buf
128+
# We can only write 20 bytes at a time.
129+
offset = 0
130+
while offset < len(buf):
131+
self._nus_tx_char.value = buf[offset:offset+20]
132+
offset += 20

0 commit comments

Comments
 (0)