I'm wondering what is the proper way to clear TDRE and TC flags.
According to the reference manual, in the ISR we shall read the UARTx_S1 and then write to UARTx_D to clear the flags.
But if there isn't more data to be sent, then writing to D register will cause NULL or what ever values to be shifted out.
To correct that I'm doing, disable transmission [TE], write to D and then perform a TXFLUSH.
Is this the correct way or there is a better one?