But in my application, I have to do this MUCH faster than just reading all data. Arduino hardware serial uses RX ring/circular buffer - so I would like to simply override buffer head address with buffer tails address . If im thinking right, this would be the fastest way of clearing rx buffer, but I cant really find any information about those tail/head addresses. Any advices on that?
Robin2:
What you have posted is how I would do it.
How long do you think that piece of code takes to complete?
How quickly (in microseconds) do you need to clear the buffer?
...R
My application is based on very precise time windows, which are set to 500uS. Since I was having a 40 bytes in RX buffer I had to waste lot of time discarding it ( over 300uS ). Why do I have stuff in RX buffer that I dont want to read? Its because I'm making multiple nodes ( Arduino Unos ) talking over MAX485 in order