spark/core-firmware — pull request #138 by Mike43110 (2014-03-02 15:15:00+00:00)
Title: Changed flush() to flush all bytes in buffer

Flush was changed to wait until the ring buffer is empty and to wait for the final frame to have been transmitted before being complete.

or:

flush()
wait for ring buffer to empty;
wait for final frame to be transmitted;
unset transmitting;