mirror of https://github.com/ArduPilot/ardupilot
Add ::peek for compatibility with trunk Arduino.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@943 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
parent
73eab31d0c
commit
0fd1228e27
|
@ -209,6 +209,19 @@ FastSerial::read(void)
|
|||
return(c);
|
||||
}
|
||||
|
||||
int
|
||||
FastSerial::peek(void)
|
||||
{
|
||||
|
||||
// if the head and tail are equal, the buffer is empty
|
||||
if (!_open || (_rxBuffer->head == _rxBuffer->tail))
|
||||
return(-1);
|
||||
|
||||
// pull character from tail
|
||||
return(_rxBuffer->bytes[_rxBuffer->tail]);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FastSerial::flush(void)
|
||||
{
|
||||
|
|
|
@ -100,6 +100,7 @@ public:
|
|||
virtual void end(void);
|
||||
virtual int available(void);
|
||||
virtual int read(void);
|
||||
virtual int peek(void);
|
||||
virtual void flush(void);
|
||||
virtual void write(uint8_t c);
|
||||
using BetterStream::write;
|
||||
|
|
Loading…
Reference in New Issue