I've written a C routine for reading a full string from the UART into a buffer.
2 problems I faced: timeout (implemented using timer0) and when to stop receiving.
In this code I detect a \r\n sequence and see that as the end of the incoming data,
but what if there are multiple \r\n in one received string? How do you know when you
received the full string?