imporve USB Serial.write()

This commit is contained in:
hathach committed 2018-10-22 13:18:01 +07:00
1 parent 5c69bdde99
commit 2f8cda787e
2 files changed
+11 -1

No files matched your search

+9 -1
View File
@@ -98,7 +98,15 @@ size_t USBSerial::write(uint8_t ch)
size_t USBSerial::write(const uint8_t *buffer, size_t size)
{
return tud_cdc_write(buffer, size);
while ( size )
{
size_t wrcount = tud_cdc_write(buffer, size);
size -= wrcount;
buffer += wrcount;
// Write FIFO is full, flush and re-write
if ( size ) tud_cdc_write_flush();
}
}
#endif // NRF52840_XXAA
@@ -18,6 +18,8 @@
void setup()
{
Serial.begin(115200);
while ( !Serial ) {} // for nrf52840 with native usb
Serial.println("Bluefruit52 Memory Info Example");
Serial.println("-------------------------------\n");
}