Skip to content

Commit 164456f

Browse files
Arduino 1.0 compliant
1 parent 59e176c commit 164456f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

TFTLCD.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ void TFTLCD::setTextColor(uint16_t c) {
7474
textcolor = c;
7575
}
7676

77+
#if ARDUINO >= 100
78+
size_t TFTLCD::write(uint8_t c) {
79+
#else
7780
void TFTLCD::write(uint8_t c) {
81+
#endif
7882
if (c == '\n') {
7983
cursor_y += textsize*8;
8084
cursor_x = 0;
@@ -84,6 +88,9 @@ void TFTLCD::write(uint8_t c) {
8488
drawChar(cursor_x, cursor_y, c, textcolor, textsize);
8589
cursor_x += textsize*6;
8690
}
91+
#if ARDUINO >= 100
92+
return 1;
93+
#endif
8794
}
8895

8996
void TFTLCD::drawString(uint16_t x, uint16_t y, char *c,

TFTLCD.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
// Graphics library by ladyada/adafruit with init code from Rossum
22
// MIT license
33

4-
#include <WProgram.h>
4+
#if ARDUINO >= 100
5+
#include "Arduino.h"
6+
#else
7+
#include "WProgram.h"
8+
#endif
59

610
// comment or uncomment the next line for special pinout!
711
//#define USE_ADAFRUIT_SHIELD_PINOUT
@@ -94,7 +98,11 @@ class TFTLCD : public Print {
9498
void setCursor(uint16_t x, uint16_t y);
9599
void setTextColor(uint16_t c);
96100
void setTextSize(uint8_t s);
101+
#if ARDUINO >= 100
102+
virtual size_t write(uint8_t);
103+
#else
97104
virtual void write(uint8_t);
105+
#endif
98106

99107
void drawChar(uint16_t x, uint16_t y, char c, uint16_t color, uint8_t s = 1);
100108
void drawString(uint16_t x, uint16_t y, char *c, uint16_t color, uint8_t s = 1);

0 commit comments

Comments
 (0)