Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase SerialUSB speed #833

Merged
merged 2 commits into from
Sep 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cores/rp2040/SerialUSB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ int SerialUSB::peek() {
}

uint8_t c;
tud_task();
return tud_cdc_peek(&c) ? (int) c : -1;
}

Expand All @@ -79,6 +80,7 @@ int SerialUSB::read() {
return -1;
}

tud_task();
if (tud_cdc_available()) {
return tud_cdc_read_char();
}
Expand All @@ -91,6 +93,7 @@ int SerialUSB::available() {
return 0;
}

tud_task();
return tud_cdc_available();
}

Expand All @@ -100,6 +103,7 @@ int SerialUSB::availableForWrite() {
return 0;
}

tud_task();
return tud_cdc_write_available();
}

Expand All @@ -110,6 +114,7 @@ void SerialUSB::flush() {
}

tud_cdc_write_flush();
tud_task();
}

size_t SerialUSB::write(uint8_t c) {
Expand Down Expand Up @@ -151,6 +156,7 @@ size_t SerialUSB::write(const uint8_t *buf, size_t length) {
// reset our timeout
last_avail_time = 0;
}
tud_task();
return written;
}

Expand Down