Post
by Roberthh » Sat Sep 11, 2021 2:29 pm
Actually there is no API or method checking whether all UART data has been sent. As far as I recall, it was discussed but not implemented. So I see two ways of doing it as of now:
a) Calculate a delay based on the UART baud rate and message size and wait for that time ( like time.sleep_us((1_000_000 * 10 * msg_len) // baud_rate) )
b) Connect the UARt output to another UART input on that module and wait until you have all symbols received, that you have sent.
a) is not overly precise. You would have to add some guard time.
b) Is precise, but waste of resources.
So yes, a method for telling if all has been sent (the opposite to uart.any()) would be helpful.