Permalink
Browse files

Arduino 1.0 compliant

  • Loading branch information...
1 parent 59e176c commit 164456f6f514087c7175bd9f6d1d2a652e162261 @PaintYourDragon PaintYourDragon committed Dec 3, 2011
Showing with 16 additions and 1 deletion.
  1. +7 −0 TFTLCD.cpp
  2. +9 −1 TFTLCD.h
View
7 TFTLCD.cpp
@@ -74,7 +74,11 @@ void TFTLCD::setTextColor(uint16_t c) {
textcolor = c;
}
+#if ARDUINO >= 100
+size_t TFTLCD::write(uint8_t c) {
+#else
void TFTLCD::write(uint8_t c) {
+#endif
if (c == '\n') {
cursor_y += textsize*8;
cursor_x = 0;
@@ -84,6 +88,9 @@ void TFTLCD::write(uint8_t c) {
drawChar(cursor_x, cursor_y, c, textcolor, textsize);
cursor_x += textsize*6;
}
+#if ARDUINO >= 100
+ return 1;
+#endif
}
void TFTLCD::drawString(uint16_t x, uint16_t y, char *c,
View
10 TFTLCD.h
@@ -1,7 +1,11 @@
// Graphics library by ladyada/adafruit with init code from Rossum
// MIT license
-#include <WProgram.h>
+#if ARDUINO >= 100
+ #include "Arduino.h"
+#else
+ #include "WProgram.h"
+#endif
// comment or uncomment the next line for special pinout!
//#define USE_ADAFRUIT_SHIELD_PINOUT
@@ -94,7 +98,11 @@ class TFTLCD : public Print {
void setCursor(uint16_t x, uint16_t y);
void setTextColor(uint16_t c);
void setTextSize(uint8_t s);
+#if ARDUINO >= 100
+ virtual size_t write(uint8_t);
+#else
virtual void write(uint8_t);
+#endif
void drawChar(uint16_t x, uint16_t y, char c, uint16_t color, uint8_t s = 1);
void drawString(uint16_t x, uint16_t y, char *c, uint16_t color, uint8_t s = 1);

0 comments on commit 164456f

Please sign in to comment.