serial.flush()

I have a serial compass that spews data at a regular rate. GENERALLY my code outruns its refresh rate and its fine, however there are several common times where the buffer may have a chance to build up, and once this happens I will always be several samples behind untill the buffer runs it self over and my code gets mad at me. In order to have the date read from the buffer be as fresh as possible I want to "flush" the RX buffer about 20 ms before my compass read routine. 20 ms is perfect as I have a block of code guaranteed to take 20-39 ms to run, so I will flush the buffer prior to that and shazzam, fresh picked compass data

I was pulling my hair out trying to find such a function, although when you put it that way I can see how having the buffer empty function that I spoke of is less common of a need than I thought.

IMHO the serial buffer needs to be slightly better explained in the reference section, it took me about 3 weeks to wrap my head around the basics, and am only now realizing the SLIGHTLY more technical things like the fact that it overwrites old data when full, and does not simply get blocked up and ignore new data. also the flush bit is really confusing. specifically on the Stream class page. I was under the impression for a long time that there was a hardware UART buffer, but I think at this point i have learned the buffer is in my RAM and implemented by the benevolent arduino gods.