From 59adc64ba668f4bd76c92ec42bad865ba65779ac Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Mon, 19 Sep 2005 10:57:06 +0000 Subject: [PATCH] Added serialRead and serialAvailable. --- core/wiring.c | 10 ++++++++++ core/wiring.h | 2 ++ 2 files changed, 12 insertions(+) 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);