Skip to content

Commit 583e7d1

Browse files
authored
Add multithreding support to HardwareSerial
This fix will allow use HardwareSerial driver in simple multithreading applications.
1 parent 378736e commit 583e7d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hardware/arduino/avr/cores/arduino/HardwareSerial.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ size_t HardwareSerial::write(uint8_t c)
235235
if(bit_is_set(*_ucsra, UDRE0))
236236
_tx_udr_empty_irq();
237237
} else {
238-
// nop, the interrupt handler will free up space for us
238+
// share CPU when buffer free waiting
239+
yield();
239240
}
240241
}
241242

0 commit comments

Comments
 (0)