Updated max_LCD to inherit the standard Print class

Works both in Arduino < 1.0.0 and newer versions of Arduino
This commit is contained in:
Kristian Lauszus 2013-12-07 00:32:21 +01:00
parent 4533e3cd44
commit 00442ce2e5
2 changed files with 15 additions and 2 deletions

View file

@ -223,9 +223,16 @@ inline void Max_LCD::command(uint8_t value) {
delayMicroseconds(100);
}
#if defined(ARDUINO) && ARDUINO >=100
inline size_t Max_LCD::write(uint8_t value) {
LCD_sendchar(value);
return 1; // Assume success
}
#else
inline void Max_LCD::write(uint8_t value) {
LCD_sendchar(value);
}
#endif
void Max_LCD::sendbyte(uint8_t val) {
lcdPins &= 0x0f; //prepare place for the upper nibble

View file

@ -62,7 +62,7 @@ e-mail : support@circuitsathome.com
#define LCD_5x10DOTS 0x04
#define LCD_5x8DOTS 0x00
class Max_LCD //: public Print
class Max_LCD : public Print
{
USB *pUsb;
@ -86,9 +86,15 @@ public:
void noAutoscroll();
void createChar(uint8_t, uint8_t[]);
void setCursor(uint8_t, uint8_t);
virtual void write(uint8_t);
void command(uint8_t);
#if defined(ARDUINO) && ARDUINO >=100
virtual size_t write(uint8_t);
using Print::write;
#else
virtual void write(uint8_t);
#endif
private:
void sendbyte(uint8_t val);
uint8_t _displayfunction; //tokill