SpenceKonde / megaTinyCore

Arduino core for the tinyAVR 0/1/2-series - Ones's digit 2,4,5,7 (pincount, 8,14,20,24), tens digit 0, 1, or 2 (featureset), preceded by flash in kb. Library maintainers: porting help available!
Other
563 stars 148 forks source link

Fix hang in Serial.flush() #1164

Open jvasileff opened 2 weeks ago

jvasileff commented 2 weeks ago

_state will be 0x2 for half-duplex mode, so we need to be careful with operator precedence to test only the low bit. Without this change, Serial.flush() hangs when half-duplex is enabled and no data has yet been sent.