We have fgets() for reading lines form stdin, and f_fgets() for reading lines from EFFS volumes. I'm looking for an easy way to do the same thing from the input to non-stdio serial ports accessed via an fd returned by call to OpenSerial() and wrote the following. Is there an easier way or an existing function? Just seems like reading char-by-char would be dog slow, but I guess this is required if you need to find the terminator LF char?
There are only two other alternatives I can think of at the moment:
1. Write your own serial driver that handles cr/lf (probably not a good option)
2. You can read all available characters into a buffer, and then parse the buffer looking for the lf. Not a whole lot better, but probably less overhead.