diff --git a/core/wiring.c b/core/wiring.c index d82950e2d..d9c3c426b 100755 --- a/core/wiring.c +++ b/core/wiring.c @@ -220,6 +220,16 @@ void serialWrite(unsigned char c) uartSendByte(c); } +int serialAvailable() +{ + return uartGetRxBuffer()->datalength; +} + +int serialRead() +{ + return uartGetByte(); +} + void printMode(int mode) { // do nothing, we only support serial printing, not lcd. diff --git a/core/wiring.h b/core/wiring.h index d63ec9cfb..18a05ae00 100755 --- a/core/wiring.h +++ b/core/wiring.h @@ -67,6 +67,8 @@ void setup(void); void loop(void); void beginSerial(int); void serialWrite(unsigned char); +int serialAvailable(); +int serialRead(); void print(const char *, ...); void printMode(int);