-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Extend Stream to provide remove(count) and peek(offset) #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
app/bin/ | ||
app/pde.jar | ||
build/.DS_Store | ||
build/macosx/work/ | ||
core/bin/ | ||
core/core.jar |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,16 @@ | |
|
||
#include "Stream.h" | ||
|
||
// Define constants and variables for buffering incoming serial data. We're | ||
// using a ring buffer (I think), in which rx_buffer_head is the index of the | ||
// location to which to write the next incoming character and rx_buffer_tail | ||
// is the index of the location from which to read. | ||
#if (RAMEND < 1000) | ||
#define RX_BUFFER_SIZE 32 | ||
#else | ||
#define RX_BUFFER_SIZE 128 | ||
#endif | ||
|
||
struct ring_buffer; | ||
|
||
class HardwareSerial : public Stream | ||
|
@@ -50,11 +60,16 @@ class HardwareSerial : public Stream | |
uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x); | ||
void begin(long); | ||
void end(); | ||
virtual int available(void); | ||
virtual int peek(void); | ||
virtual int read(void); | ||
virtual void flush(void); | ||
virtual void write(uint8_t); | ||
|
||
// @todo I think these only need to be declared virtual if HWSerial's going to be extended | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, virtual is not needed. If a derived object implements I wouldn't use |
||
int available(void); | ||
int peek(void); | ||
int peek(uint8_t); | ||
void remove(uint8_t); | ||
int read(void); | ||
void flush(void); | ||
void write(uint8_t); | ||
|
||
using Print::write; // pull in write(str) and write(buf, size) from Print | ||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this gitignore file is really not needed.