A robust flush() solution has to handle all conditions when called.
- A character in the transmit shift register and no character in TXB.
- A character in TXB and in the transmit shift register
- No characters in TXB or the shift register.
What I found is that some potential solutions didn't handle all of the
above situations or couldn't handle them more than once.
Well many of us use to complain that the serial transmitting function was a simple blocking command so I guess the lesson is to be very careful what you ask for as you may get it. ![]()