Boo0ns / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Enhance HardwareSerial::peek(), add HardwareSerial::remove() #376

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I needed more flexible access to the serial receive buffer, without having to 
copy it to a local buffer.  I implemented peek(uint8_t offset) and 
remove(uint8_t count) in 0018 for my own use.  peek() allows me to look at any 
position in the buffer (< the number of bytes available) without removing data 
from the buffer.  remove() allows me to remove multiple bytes from the buffer 
at once without having to loop with read() and available().

Patch against 0018 attached.

Original issue reported on code.google.com by bla...@bravo5.org on 13 Oct 2010 at 3:04

Attachments:

GoogleCodeExporter commented 9 years ago
There's a pull request for a patch that does this to all Streams here: 
https://github.com/arduino/Arduino/pull/17

It's probably more current than the patch above. Not sure which is the better 
one though, haven't looked at the code, just remembered seeing this pull 
request the other day.

Original comment by lars.j.n...@gmail.com on 6 Mar 2012 at 7:27