Skip to content

Commit

Permalink
usb: ensure all the data is written
Browse files Browse the repository at this point in the history
  • Loading branch information
bkleiner committed Dec 5, 2021
1 parent 50408c8 commit 68d1b3b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/drivers/drv_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,12 @@ void usb_serial_write(uint8_t *data, uint32_t len) {
while (tx_buffer_in_use)
;

tx_buffer_in_use = true;
circular_buffer_write_multi(&tx_buffer, data, len);
tx_buffer_in_use = false;
uint32_t written = 0;
while (written < len) {
tx_buffer_in_use = true;
written += circular_buffer_write_multi(&tx_buffer, data + written, len - written);
tx_buffer_in_use = false;
}
}

void usb_serial_print(char *str) {
Expand Down

0 comments on commit 68d1b3b

Please sign in to comment.