aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2008-05-07 18:24:49 +0000
committerDavid A. Mellis <d.mellis@arduino.cc>2008-05-07 18:24:49 +0000
commit4b2b39e383d7fec0f94deb0f9a75a493bce2d0ca (patch)
tree43c30ba64a83d21416e640cd532a5cd4198b4f55 /cores/arduino
parent2d5bc015fbd70befc08c2295630ff06770e9d7c8 (diff)
Changing Print class to use regular virtual write() function (instead of my hack
ed together version).
Diffstat (limited to 'cores/arduino')
-rwxr-xr-xcores/arduino/HardwareSerial.cpp8
-rwxr-xr-xcores/arduino/HardwareSerial.h3
-rwxr-xr-xcores/arduino/Print.cpp8
-rwxr-xr-xcores/arduino/Print.h3
4 files changed, 3 insertions, 19 deletions
diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp
index 76cd9b0..aab7fc5 100755
--- a/cores/arduino/HardwareSerial.cpp
+++ b/cores/arduino/HardwareSerial.cpp
@@ -26,14 +26,6 @@
#include "HardwareSerial.h"
-void HardwareSerialWrite(uint8_t value, void *instance) {
- ((HardwareSerial *) instance)->write(value);
-}
-
-// Constructors ////////////////////////////////////////////////////////////////
-
-HardwareSerial::HardwareSerial() : Print(HardwareSerialWrite) {}
-
// Public Methods //////////////////////////////////////////////////////////////
void HardwareSerial::begin(long speed)
diff --git a/cores/arduino/HardwareSerial.h b/cores/arduino/HardwareSerial.h
index f2c6ce8..e4cb969 100755
--- a/cores/arduino/HardwareSerial.h
+++ b/cores/arduino/HardwareSerial.h
@@ -27,12 +27,11 @@
class HardwareSerial : public Print
{
public:
- HardwareSerial();
void begin(long);
uint8_t available(void);
int read(void);
void flush(void);
- void write(uint8_t);
+ virtual void write(uint8_t);
};
extern HardwareSerial Serial;
diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp
index b8a85a7..d150b75 100755
--- a/cores/arduino/Print.cpp
+++ b/cores/arduino/Print.cpp
@@ -26,17 +26,11 @@
#include "Print.h"
-// Constructors ////////////////////////////////////////////////////////////////
-
-Print::Print(void (*write)(uint8_t, void *)) {
- this->write = write;
-}
-
// Public Methods //////////////////////////////////////////////////////////////
void Print::print(uint8_t b)
{
- write(b, this);
+ write(b);
}
void Print::print(char c)
diff --git a/cores/arduino/Print.h b/cores/arduino/Print.h
index 5cac3f2..8cec235 100755
--- a/cores/arduino/Print.h
+++ b/cores/arduino/Print.h
@@ -32,9 +32,8 @@ class Print
{
private:
void printNumber(unsigned long, uint8_t);
- void (*write)(uint8_t, void *);
public:
- Print(void (*)(uint8_t, void *));
+ virtual void write(uint8_t);
void print(char);
void print(const char[]);
void print(uint8_t);