Arduino's Serial (Serial - Arduino Reference) library is very good!
It is easy to use and satisfies most needs.
However, sometime we need more.
In my application half-dublex communication application, I need to change the direction of a transmit/receive multiplexer when transmission finishes. Timing is critical! Thus I need to know when Serial.write or Serial.print finish its job.
I think it would be very usefull if following behaviour/functionality can be added to the Serial library;
A generic way of testing if Serial finishes its send function
?A generic way of testing if Serial finishes its send function
A "Serial.print" or "write" returns as soon as the last byte has been written to the Tx register.
Sure, the line won't be "free" until the Tx register is empty again, but such a function is easy to write.
A "Serial.print" or "write" returns as soon as the last byte has been written to the Tx register.
Sure, the line won't be "free" until the Tx register is empty again, but such a function is easy to write.
It may be "easy" for you. But, it is not so trival for other novice people like me.
Can you please share your solution with us so that we can learn from you?
How to make a generic solution (i.e. a solution applicable to Serial, Serial1, Serial2, Serial3) if the last bit has left the processor?
Thank you for help and sharing your experience with us.