@hathach's changes; check cdc connected during string write
This commit is contained in:
parent
9d43a25d6e
commit
e5e9d2ba47
@ -52,15 +52,13 @@ bool serial_bytes_available(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void serial_write_substring(const char* text, uint32_t length) {
|
void serial_write_substring(const char* text, uint32_t length) {
|
||||||
#if CIRCUITPY_DISPLAYIO
|
#if CIRCUITPY_DISPLAYIO
|
||||||
int errcode;
|
int errcode;
|
||||||
common_hal_terminalio_terminal_write(&supervisor_terminal, (const uint8_t*) text, length, &errcode);
|
common_hal_terminalio_terminal_write(&supervisor_terminal, (const uint8_t*) text, length, &errcode);
|
||||||
#endif
|
#endif
|
||||||
if (!tud_cdc_connected()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
while (count < length) {
|
while (count < length && tud_cdc_connected()) {
|
||||||
count += tud_cdc_write(text + count, length - count);
|
count += tud_cdc_write(text + count, length - count);
|
||||||
usb_background();
|
usb_background();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user