Skip to content

Commit 1de7ea4

Browse files
committed
Write in chunks of 20 bytes or less
1 parent 52f7488 commit 1de7ea4

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)