mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
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:
parent
4533e3cd44
commit
00442ce2e5
2 changed files with 15 additions and 2 deletions
|
@ -223,9 +223,16 @@ inline void Max_LCD::command(uint8_t value) {
|
||||||
delayMicroseconds(100);
|
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) {
|
inline void Max_LCD::write(uint8_t value) {
|
||||||
LCD_sendchar(value);
|
LCD_sendchar(value);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Max_LCD::sendbyte(uint8_t val) {
|
void Max_LCD::sendbyte(uint8_t val) {
|
||||||
lcdPins &= 0x0f; //prepare place for the upper nibble
|
lcdPins &= 0x0f; //prepare place for the upper nibble
|
||||||
|
|
10
max_LCD.h
10
max_LCD.h
|
@ -62,7 +62,7 @@ e-mail : support@circuitsathome.com
|
||||||
#define LCD_5x10DOTS 0x04
|
#define LCD_5x10DOTS 0x04
|
||||||
#define LCD_5x8DOTS 0x00
|
#define LCD_5x8DOTS 0x00
|
||||||
|
|
||||||
class Max_LCD //: public Print
|
class Max_LCD : public Print
|
||||||
{
|
{
|
||||||
USB *pUsb;
|
USB *pUsb;
|
||||||
|
|
||||||
|
@ -86,9 +86,15 @@ public:
|
||||||
void noAutoscroll();
|
void noAutoscroll();
|
||||||
void createChar(uint8_t, uint8_t[]);
|
void createChar(uint8_t, uint8_t[]);
|
||||||
void setCursor(uint8_t, uint8_t);
|
void setCursor(uint8_t, uint8_t);
|
||||||
virtual void write(uint8_t);
|
|
||||||
void command(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:
|
private:
|
||||||
void sendbyte(uint8_t val);
|
void sendbyte(uint8_t val);
|
||||||
uint8_t _displayfunction; //tokill
|
uint8_t _displayfunction; //tokill
|
||||||
|
|
Loading…
Reference in a new issue