usb: ensure all the data is written
@@ -379,10 +379,13 @@ void usb_serial_write(uint8_t *data, uint32_t len) {
while (tx_buffer_in_use)
;
+ uint32_t written = 0;
+ while (written < len) {
tx_buffer_in_use = true;
- circular_buffer_write_multi(&tx_buffer, data, len);
+ written += circular_buffer_write_multi(&tx_buffer, data + written, len - written);
tx_buffer_in_use = false;
}
+}
void usb_serial_print(char *str) {
usb_serial_write((uint8_t *)str, strlen(str));
