Skip to content

Commit 1cfc951

Browse files
Adjust SerialPIO flush timeouts
Fixes #3256 Reduce the minimum timeout for SerialPIO::flush from 1ms to 1us.
1 parent db59e47 commit 1cfc951

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/rp2040/SerialPIO.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,10 @@ void SerialPIO::flush() {
355355
return;
356356
}
357357
while (!pio_sm_is_tx_fifo_empty(_txPIO, _txSM)) {
358-
delay(1); // Wait for all FIFO to be read
358+
/* noop */ // Busy wait for all FIFO to be read
359359
}
360360
// Could have 1 byte being transmitted, so wait for bit times
361-
delay((1000 * (_txBits + 1)) / _baud);
361+
delayMicroseconds((1000000 * (_txBits + 3 /* start + stop + parity */)) / _baud);
362362
}
363363

364364
size_t SerialPIO::write(uint8_t c) {

0 commit comments

Comments
 (0)