View Full Version : Getting a way to detect data output completion

08-11-2013, 02:34 AM
Hi, I'm wondering if there would be some way to change the API for "serial" data output such that you could query whether all the output was complete? As part of adding support for low power operation I would like to avoid going into low power mode (which disables things like the USB and UART output) until all previous output was complete. I know that for the hardware serial (and maybe the USB serial) I could do a "flush" function call that would block further operation until all the data finished being output. But I don't want to block my program. I just want to keep doing things and avoid low power mode until output is complete.

Basically, I'm thinking it would just be nice to have some status function call as part of the serial library that would return the state of the "transmitting" flag used in serial1.c and the other serial source code files.

I haven't really looked at the USB serial stuff yet but have the same need to try to wait for and data that has been sent out over the USB serial emulation port to complete before I go into low power mode and end up with the USB disabled. Again, I'd like a non-blocking way to do this.

Does this make sense?