summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'libraries')
-rw-r--r--libraries/MultiLCD/ILI9325D.cpp25
-rw-r--r--libraries/MultiLCD/ILI9341.cpp6
-rw-r--r--libraries/MultiLCD/MultiLCD.cpp394
-rw-r--r--libraries/MultiLCD/MultiLCD.h150
-rw-r--r--libraries/MultiLCD/PCD8544.cpp316
-rw-r--r--libraries/MultiLCD/PCD8544.h117
-rw-r--r--libraries/MultiLCD/SH1106.cpp401
-rw-r--r--libraries/MultiLCD/SSD1289.cpp393
-rw-r--r--libraries/MultiLCD/SSD1306.cpp273
-rw-r--r--libraries/MultiLCD/SSD1306.h112
-rw-r--r--libraries/MultiLCD/UTFT.cpp985
-rw-r--r--libraries/MultiLCD/UTFT.h275
-rw-r--r--libraries/MultiLCD/fonts.h (renamed from libraries/MultiLCD/fonts.cpp)95
-rw-r--r--libraries/MultiLCD/memorysaver.h45
14 files changed, 1839 insertions, 1748 deletions
diff --git a/libraries/MultiLCD/ILI9325D.cpp b/libraries/MultiLCD/ILI9325D.cpp
index 5163193..ac4cfcf 100644
--- a/libraries/MultiLCD/ILI9325D.cpp
+++ b/libraries/MultiLCD/ILI9325D.cpp
@@ -428,13 +428,34 @@ void LCD_ILI9325D::draw(const PROGMEM byte* buffer, uint16_t width, uint16_t hei
m_y += width;
}
-void LCD_ILI9325D::draw2x(const PROGMEM byte* buffer, byte width, byte height)
+void LCD_ILI9325D::draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height, byte scaleX, byte scaleY)
+{
+ byte rows = height >> 3;
+ if (scaleY == 0) scaleY = scaleX;
+ setXY(m_x, m_x + height - 1, m_y, m_y + width - 1);
+ uint16_t i = width - 1;
+ do {
+ for (byte n = 0; n < scaleX; n++) {
+ for (uint8_t h = 0; h < rows; h++) {
+ byte d = pgm_read_byte_far(buffer + i + width * h);
+ for (byte j = 0; j < 8; j++, d >>= 1) {
+ for (byte m = 0; m < scaleY; m++) {
+ WriteData(m_color[d & 1]);
+ }
+ }
+ }
+ }
+ } while (i--);
+ m_y += width * scaleX;
+}
+
+void LCD_ILI9325D::draw4bpp(const PROGMEM byte* buffer, uint16_t width, uint16_t height)
{
char buf[240];
setXY(m_x, m_x + height * 2 - 1, m_y, m_y + width * 2- 1);
uint16_t i = width - 1;
do {
- memcpy_P(buf, buffer + (uint16_t)i * height * 2, height * 2);
+ memcpy_P(buf, buffer + i * height * 2, height * 2);
for (byte j = 0; j < height * 2; j += 2) {
WriteData(buf[j], buf[j + 1]);
WriteData(buf[j], buf[j + 1]);
diff --git a/libraries/MultiLCD/ILI9341.cpp b/libraries/MultiLCD/ILI9341.cpp
index 5c6df57..32b2356 100644
--- a/libraries/MultiLCD/ILI9341.cpp
+++ b/libraries/MultiLCD/ILI9341.cpp
@@ -241,8 +241,8 @@ void LCD_ILI9341::begin (void)
clear();
backlight(true);
- setTextColor(0xffff);
- SetBGColor(0);
+ setColor(0xffff);
+ setBackColor(0);
}
uint8_t LCD_ILI9341::readID(void)
@@ -487,7 +487,7 @@ void LCD_ILI9341::draw(const PROGMEM byte* buffer, uint16_t width, uint16_t heig
m_x += width;
}
-void LCD_ILI9341::draw2x(const PROGMEM byte* buffer, byte width, byte height)
+void LCD_ILI9341::draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height, byte scaleX, byte ScaleY)
{
byte rows = height >> 3;
setXY(m_y, m_y + height * 2 - 1, m_x, m_x + width * 2 - 1);
diff --git a/libraries/MultiLCD/MultiLCD.cpp b/libraries/MultiLCD/MultiLCD.cpp
index 33c753b..d55874f 100644
--- a/libraries/MultiLCD/MultiLCD.cpp
+++ b/libraries/MultiLCD/MultiLCD.cpp
@@ -7,7 +7,9 @@
#include <Arduino.h>
#include <Wire.h>
+#include <UTFT.h>
#include "MultiLCD.h"
+#include "fonts.h"
void LCD_Common::printInt(uint16_t value, int8_t padding)
{
@@ -44,395 +46,3 @@ void LCD_Common::printLong(uint32_t value, int8_t padding)
writeDigit(v);
}
}
-
-void LCD_PCD8544::writeDigit(byte n)
-{
- if (m_font == FONT_SIZE_SMALL) {
- write(n >= 0 && n <= 9 ? '0' + n : ' ');
- } else if (m_font == FONT_SIZE_MEDIUM) {
- unsigned char data[8];
- if (n >= 0 && n <= 9) {
- memcpy_P(data, digits8x8[n], 8);
- } else {
- memset(data, 0, sizeof(data));
- }
- draw8x8(data);
- } else {
- unsigned char data[32];
- if (n >= 0 && n <= 9) {
- memcpy_P(data, digits16x16[n], 32);
- } else {
- memset(data, 0, sizeof(data));
- }
- draw16x16(data);
- //column += 16;
- }
-}
-
-
-void LCD_PCD8544::draw(const unsigned char *data, unsigned char width, unsigned char height)
-{
- height >>= 3;
- unsigned char x = column;
- unsigned char y = line << 3;
- for (unsigned char y = 0; y < height; y++) {
- setCursor(x, y);
- for (unsigned char x = 0; x < width; x++) {
- send(PCD8544_DATA, data[y * width + x]);
- }
- }
-}
-
-void LCD_SSD1306::setCursor(byte column, byte line)
-{
- m_col = column;
- m_row = line;
- ssd1306_command(0xB0 + m_row);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-}
-
-size_t LCD_SSD1306::write(uint8_t c)
-{
- uint8_t twbrbackup = TWBR;
- TWBR = 18; // upgrade to 400KHz!
- if (c == '\n') {
- setCursor(0, m_row + ((m_font == FONT_SIZE_SMALL) ? 1 : 2));
- return 1;
- } else if (c == '\r') {
- m_col = 0;
- return 1;
- }
-#ifndef MEMORY_SAVING
- if (m_font == FONT_SIZE_SMALL) {
-#endif
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- if (c > 0x20 && c < 0x7f) {
- c -= 0x21;
- for (byte i = 0; i < 5; i++) {
- byte d = pgm_read_byte(&font5x8[c][i]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.write(0);
- } else {
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 11 : 6; i > 0; i--) {
- Wire.write(0);
- }
- }
- Wire.endTransmission();
- m_col += (m_flags & FLAG_PIXEL_DOUBLE_H) ? 11 : 6;
- if (m_col >= 128) {
- m_col = 0;
- m_row ++;
- }
-#ifndef MEMORY_SAVING
- } else {
- if (c > 0x20 && c < 0x7f) {
- c -= 0x21;
-
- ssd1306_command(0xB0 + m_row);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (byte i = 0; i <= 14; i += 2) {
- byte d = pgm_read_byte(&font8x16_terminal[c][i]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.endTransmission();
-
- ssd1306_command(0xB0 + m_row + 1);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (byte i = 1; i <= 15; i += 2) {
- byte d = pgm_read_byte(&font8x16_terminal[c][i]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.endTransmission();
- } else {
- ssd1306_command(0xB0 + m_row);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 16 : 8; i > 0; i--) {
- Wire.write(0);
- }
- Wire.endTransmission();
-
- ssd1306_command(0xB0 + m_row + 1);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 16 : 8; i > 0; i--) {
- Wire.write(0);
- }
- Wire.endTransmission();
- }
- m_col += (m_flags & FLAG_PIXEL_DOUBLE_H) ? 17 : 9;
- if (m_col >= 128) {
- m_col = 0;
- m_row += 2;
- }
- }
-#endif
- TWBR = twbrbackup;
- return 1;
-}
-
-void LCD_SSD1306::writeDigit(byte n)
-{
- uint8_t twbrbackup = TWBR;
- TWBR = 18; // upgrade to 400KHz!
- if (m_font == FONT_SIZE_SMALL) {
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- if (n <= 9) {
- n += '0' - 0x21;
- for (byte i = 0; i < 5; i++) {
- Wire.write(pgm_read_byte(&font5x8[n][i]));
- }
- Wire.write(0);
- } else {
- for (byte i = 0; i < 6; i++) {
- Wire.write(0);
- }
- }
- Wire.endTransmission();
- m_col += 6;
- } else if (m_font == FONT_SIZE_MEDIUM) {
- write(n <= 9 ? ('0' + n) : ' ');
- } else if (m_font == FONT_SIZE_LARGE) {
- if (n <= 9) {
- byte i;
- ssd1306_command(0xB0 + m_row);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (i = 0; i < 16; i ++) {
- byte d = pgm_read_byte(&digits16x16[n][i]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.endTransmission();
-
- ssd1306_command(0xB0 + m_row + 1);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (; i < 32; i ++) {
- byte d = pgm_read_byte(&digits16x16[n][i]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.endTransmission();
- } else {
- ssd1306_command(0xB0 + m_row);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 32 : 16; i > 0; i--) {
- Wire.write(0);
- }
- Wire.endTransmission();
-
- ssd1306_command(0xB0 + m_row + 1);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 32 : 16; i > 0; i--) {
- Wire.write(0);
- }
- Wire.endTransmission();
- }
- m_col += (m_flags & FLAG_PIXEL_DOUBLE_H) ? 30 : 16;
- } else if (m_font == FONT_SIZE_XLARGE) {
- if (n <= 9) {
- byte i;
- ssd1306_command(0xB0 + m_row);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (i = 0; i < 16; i ++) {
- byte d = pgm_read_byte(&digits16x24[n][i * 3]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.endTransmission();
-
- ssd1306_command(0xB0 + m_row + 1);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (i = 0; i < 16; i ++) {
- byte d = pgm_read_byte(&digits16x24[n][i * 3 + 1]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.endTransmission();
-
- ssd1306_command(0xB0 + m_row + 2);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (i = 0; i < 16; i ++) {
- byte d = pgm_read_byte(&digits16x24[n][i * 3 + 2]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.endTransmission();
- } else {
- ssd1306_command(0xB0 + m_row);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 32 : 16; i > 0; i--) {
- Wire.write(0);
- }
- Wire.endTransmission();
-
- ssd1306_command(0xB0 + m_row + 1);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 32 : 16; i > 0; i--) {
- Wire.write(0);
- }
- Wire.endTransmission();
-
- ssd1306_command(0xB0 + m_row + 2);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 32 : 16; i > 0; i--) {
- Wire.write(0);
- }
- Wire.endTransmission();
- }
- m_col += (m_flags & FLAG_PIXEL_DOUBLE_H) ? 30 : 16;
- }
- TWBR = twbrbackup;
-}
-
-void LCD_SSD1306::draw(const PROGMEM byte* buffer, byte width, byte height)
-{
- ssd1306_command(SSD1306_SETLOWCOLUMN | 0x0); // low col = 0
- ssd1306_command(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0
- ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0
-
- // save I2C bitrate
- uint8_t twbrbackup = TWBR;
- TWBR = 18; // upgrade to 400KHz!
-
- const PROGMEM byte *p = buffer;
- height >>= 3;
- width >>= 3;
- for (byte i = 0; i < height; i++) {
- // send a bunch of data in one xmission
- ssd1306_command(0xB0 + i + m_row);//set page address
- ssd1306_command(m_col & 0xf);//set lower column address
- ssd1306_command(0x10 | (m_col >> 4));//set higher column address
-
- for(byte j = 0; j < 8; j++){
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (byte k = 0; k < width; k++, p++) {
- Wire.write(pgm_read_byte(p));
- }
- Wire.endTransmission();
- }
- }
- TWBR = twbrbackup;
- m_col += width;
-}
-
-void LCD_SSD1306::clearLine(byte line)
-{
- ssd1306_command(SSD1306_SETLOWCOLUMN | 0x0); // low col = 0
- ssd1306_command(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0
- ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0
-
- // save I2C bitrate
- uint8_t twbrbackup = TWBR;
- TWBR = 18; // upgrade to 400KHz!
-
- // send a bunch of data in one xmission
- ssd1306_command(0xB0 + line);//set page address
- ssd1306_command(0);//set lower column address
- ssd1306_command(0x10);//set higher column address
-
- for(byte j = 0; j < 8; j++){
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (byte k = 0; k < 16; k++) {
- Wire.write(0);
- }
- Wire.endTransmission();
- }
-
- TWBR = twbrbackup;
-}
-
-void LCD_SSD1306::clear(byte x, byte y, byte width, byte height)
-{
- ssd1306_command(SSD1306_SETLOWCOLUMN | 0x0); // low col = 0
- ssd1306_command(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0
- ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0
-
- // save I2C bitrate
- uint8_t twbrbackup = TWBR;
- TWBR = 18; // upgrade to 400KHz!
-
- height >>= 3;
- width >>= 3;
- y >>= 3;
- for (byte i = 0; i < height; i++) {
- // send a bunch of data in one xmission
- ssd1306_command(0xB0 + i + y);//set page address
- ssd1306_command(x & 0xf);//set lower column address
- ssd1306_command(0x10 | (x >> 4));//set higher column address
-
- for(byte j = 0; j < 8; j++){
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (byte k = 0; k < width; k++) {
- Wire.write(0);
- }
- Wire.endTransmission();
- }
- }
-
- setCursor(0, 0);
- TWBR = twbrbackup;
-}
diff --git a/libraries/MultiLCD/MultiLCD.h b/libraries/MultiLCD/MultiLCD.h
index 6e36301..f58cad2 100644
--- a/libraries/MultiLCD/MultiLCD.h
+++ b/libraries/MultiLCD/MultiLCD.h
@@ -4,9 +4,14 @@
* Copyright (c) 2013 Stanley Huang <stanleyhuangyc@live.com>
* All rights reserved.
*************************************************************************/
+#include <UTFT.h>
-#if !defined(__AVR_ATmega2560__) && !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega644P__) && !defined(__SAM3X8E__)
-//#define MEMORY_SAVING
+#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168P__)
+#define MEMORY_SAVING
+#endif
+
+#ifdef __arm__
+#define PROGMEM
#endif
typedef enum {
@@ -39,16 +44,16 @@ extern const PROGMEM unsigned char digits16x24[][48];
extern const PROGMEM unsigned char font8x16_doslike[][16];
extern const PROGMEM unsigned char font8x16_terminal[][16];
-#include "PCD8544.h"
-
class LCD_Common
{
public:
LCD_Common():m_font(FONT_SIZE_SMALL),m_flags(0) {}
- void setFont(FONT_SIZE size) { m_font = size; }
+ void setFontSize(FONT_SIZE size) { m_font = size; }
void setFlags(byte flags) { m_flags = flags; }
virtual void backlight(bool on) {}
- virtual void draw(const PROGMEM byte* buffer, byte width, byte height) {}
+ virtual void draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height) {}
+ virtual void draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height, byte scaleX, byte scaleY = 0) {}
+ virtual void draw4bpp(const PROGMEM byte* buffer, uint16_t width, uint16_t height) {}
void printInt(uint16_t value, int8_t padding = -1);
void printLong(uint32_t value, int8_t padding = -1);
protected:
@@ -69,63 +74,6 @@ public:
size_t write(uint8_t c) { return 0; }
};
-class LCD_PCD8544 : public LCD_Common, public PCD8544
-{
-public:
- byte getLines() { return 6; }
- byte getCols() { return 14; }
- void backlight(bool on)
- {
- pinMode(7, OUTPUT);
- digitalWrite(7, on ? HIGH : LOW);
- }
- void clearLine(byte line)
- {
- setCursor(0, line);
- for (byte i = 14; i > 0; i--) write(' ');
- }
- void draw(const PROGMEM byte* buffer, byte width, byte height);
-private:
- void writeDigit(byte n);
-};
-
-#include "SSD1306.h"
-
-class LCD_SSD1306 : public LCD_Common, public SSD1306, public Print
-{
-public:
- void setCursor(byte column, byte line);
- void draw(const PROGMEM byte* buffer, byte width, byte height);
- size_t write(uint8_t c);
- void clear(byte x = 0, byte y = 0, byte width = 128, byte height = 64);
- void clearLine(byte line);
- byte getLines() { return 21; }
- byte getCols() { return 8; }
-private:
- void writeDigit(byte n);
- byte m_col;
- byte m_row;
-};
-
-class LCD_SH1106 : public LCD_Common, public Print
-{
-public:
- void begin();
- void setCursor(byte column, byte line);
- void draw(const PROGMEM byte* buffer, byte width, byte height);
- size_t write(uint8_t c);
- void clear(byte x = 0, byte y = 0, byte width = 128, byte height = 64);
- void clearLine(byte line);
- byte getLines() { return 21; }
- byte getCols() { return 8; }
-private:
- void WriteCommand(unsigned char ins);
- void WriteData(unsigned char dat);
- void writeDigit(byte n);
- byte m_col;
- byte m_row;
-};
-
#define TFT_LINE_HEIGHT 8
class LCD_ILI9325D : public LCD_Common, public Print
@@ -142,27 +90,27 @@ public:
m_y = x;
m_x = y;
}
- void setTextColor(uint16_t color)
+ void setColor(uint16_t color)
{
m_color[1] = color;
}
- void setTextColor(uint8_t R, uint8_t G, uint8_t B)
+ void setColor(uint8_t R, uint8_t G, uint8_t B)
{
m_color[1] = ((uint16_t)R << 11) | ((uint16_t)G << 5) | B;
}
- void SetBGColor(uint16_t color)
+ void setBackColor(uint16_t color)
{
m_color[0] = color;
}
- void SetBGColor(uint8_t R, uint8_t G, uint8_t B)
+ void setBackColor(uint8_t R, uint8_t G, uint8_t B)
{
m_color[0] = ((uint16_t)R << 11) | ((uint16_t)G << 5) | B;
}
void begin();
void clear(uint16_t x = 0, uint16_t y = 0, uint16_t width = 320, uint16_t height = 240);
void draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height);
- void draw2x(const PROGMEM byte* buffer, byte width, byte height);
- void draw4bpp(const PROGMEM byte* buffer, uint16_t x, uint16_t y, uint16_t width, uint16_t height);
+ void draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height, byte scaleX, byte scaleY = 0);
+ void draw4bpp(const PROGMEM byte* buffer, uint16_t width, uint16_t height);
size_t write(uint8_t);
void clearLine(byte line)
{
@@ -201,23 +149,23 @@ public:
m_x = x;
m_y = y;
}
- void setTextColor(uint16_t color)
+ void setColor(uint16_t color)
{
m_color[1][0] = color & 0xff;
m_color[1][1] = color >> 8;
}
- void setTextColor(uint8_t R, uint8_t G, uint8_t B)
+ void setColor(uint8_t R, uint8_t G, uint8_t B)
{
uint16_t color = ((uint16_t)R << 11) | ((uint16_t)G << 5) | B;
m_color[1][0] = color & 0xff;
m_color[1][1] = color >> 8;
}
- void SetBGColor(uint16_t color)
+ void setBackColor(uint16_t color)
{
m_color[0][0] = color & 0xff;
m_color[0][1] = color >> 8;
}
- void SetBGColor(uint8_t R, uint8_t G, uint8_t B)
+ void setBackColor(uint8_t R, uint8_t G, uint8_t B)
{
uint16_t color = ((uint16_t)R << 11) | ((uint16_t)G << 5) | B;
m_color[0][0] = color & 0xff;
@@ -234,7 +182,7 @@ public:
size_t write(uint8_t);
void backlight(bool on);
void draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height);
- void draw2x(const PROGMEM byte* buffer, byte width, byte height);
+ void draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height, byte scaleX, byte scaleY = 0);
private:
void setXY(uint16_t x0, uint16_t x1, uint16_t y0, uint16_t y1);
void sendPixelData(byte d);
@@ -252,3 +200,57 @@ private:
uint16_t m_x;
uint16_t m_y;
};
+
+class LCD_SSD1289 : public UTFT, public LCD_Common
+{
+public:
+ LCD_SSD1289()
+ {
+ m_font = FONT_SIZE_MEDIUM;
+ disp_x_size = 239;
+ disp_y_size = 319;
+ display_transfer_mode = 16;
+ display_model = ITDB32S;
+ __p1 = 38;
+ __p2 = 39;
+ __p3 = 40;
+ __p4 = 41;
+ __p5 = 0;
+
+ P_RS = portOutputRegister(digitalPinToPort(38));
+ B_RS = digitalPinToBitMask(38);
+ P_WR = portOutputRegister(digitalPinToPort(39));
+ B_WR = digitalPinToBitMask(39);
+ P_CS = portOutputRegister(digitalPinToPort(40));
+ B_CS = digitalPinToBitMask(40);
+ P_RST = portOutputRegister(digitalPinToPort(41));
+ B_RST = digitalPinToBitMask(41);
+ }
+ void setCursor(uint16_t column, uint8_t line)
+ {
+ m_x = column;
+ m_y = (uint16_t)line * TFT_LINE_HEIGHT;
+ }
+ void setXY(uint16_t x, uint16_t y)
+ {
+ m_x = x;
+ m_y = y;
+ }
+ void begin();
+ void clear();
+ void draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height);
+ void draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height, byte scaleX, byte scaleY = 0);
+ void draw4bpp(const PROGMEM byte* buffer, uint16_t width, uint16_t height);
+ size_t write(uint8_t);
+ void clearLine(byte line)
+ {
+ //clear(0, line * TFT_LINE_HEIGHT, 320, 8);
+ }
+private:
+ void setXY(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
+ void writeDigit(byte n);
+ void clearPixels(uint16_t pixels);
+ void Enable();
+ void Disable();
+};
+
diff --git a/libraries/MultiLCD/PCD8544.cpp b/libraries/MultiLCD/PCD8544.cpp
deleted file mode 100644
index 6b339fe..0000000
--- a/libraries/MultiLCD/PCD8544.cpp
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * PCD8544 - Interface with Philips PCD8544 (or compatible) LCDs.
- *
- * Copyright (c) 2010 Carlos Rodrigues <cefrodrigues@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-
-#include "PCD8544.h"
-
-#include <Arduino.h>
-#include <avr/pgmspace.h>
-
-extern const PROGMEM unsigned char font5x8[][5];
-
-/*
- * If this was a ".h", it would get added to sketches when using
- * the "Sketch -> Import Library..." menu on the Arduino IDE...
- */
-
-PCD8544::PCD8544(unsigned char sclk, unsigned char sdin,
- unsigned char dc, unsigned char reset,
- unsigned char sce):
- pin_sclk(sclk),
- pin_sdin(sdin),
- pin_dc(dc),
- pin_reset(reset),
- pin_sce(sce)
-{}
-
-
-void PCD8544::begin(unsigned char model)
-{
- this->column = 0;
- this->line = 0;
-
- // Sanitize the custom glyphs...
- memset(this->custom, 0, sizeof(this->custom));
-
- // All pins are outputs (these displays cannot be read)...
- pinMode(this->pin_sclk, OUTPUT);
- pinMode(this->pin_sdin, OUTPUT);
- pinMode(this->pin_dc, OUTPUT);
- pinMode(this->pin_reset, OUTPUT);
- pinMode(this->pin_sce, OUTPUT);
-
- // Reset the controller state...
- digitalWrite(this->pin_reset, HIGH);
- digitalWrite(this->pin_sce, HIGH);
- digitalWrite(this->pin_reset, LOW);
- delay(100);
- digitalWrite(this->pin_reset, HIGH);
-
- // Set the LCD parameters...
- this->send(PCD8544_CMD, 0x21); // extended instruction set control (H=1)
- this->send(PCD8544_CMD, 0x13); // bias system (1:48)
-
- if (model == CHIP_ST7576) {
- this->send(PCD8544_CMD, 0xe0); // higher Vop, too faint at default
- this->send(PCD8544_CMD, 0x05); // partial display mode
- } else {
- this->send(PCD8544_CMD, 0xc2); // default Vop (3.06 + 66 * 0.06 = 7V)
- }
-
- this->send(PCD8544_CMD, 0x20); // extended instruction set control (H=0)
- this->send(PCD8544_CMD, 0x09); // all display segments on
-
- // Clear RAM contents...
- this->clear();
-
- // Activate LCD...
- this->send(PCD8544_CMD, 0x08); // display blank
- this->send(PCD8544_CMD, 0x0c); // normal mode (0x0d = inverse mode)
- delay(100);
-
- // Place the cursor at the origin...
- this->send(PCD8544_CMD, 0x80);
- this->send(PCD8544_CMD, 0x40);
-}
-
-
-void PCD8544::stop()
-{
- this->clear();
- this->setPower(false);
-}
-
-
-void PCD8544::clear()
-{
- this->setCursor(0, 0);
-
- for (unsigned short i = 0; i < PCD8544_WIDTH * (PCD8544_HEIGHT/8); i++) {
- this->send(PCD8544_DATA, 0x00);
- }
-
- this->setCursor(0, 0);
-}
-
-
-void PCD8544::clearLine()
-{
- this->setCursor(0, this->line);
-
- for (unsigned char i = 0; i < PCD8544_WIDTH; i++) {
- this->send(PCD8544_DATA, 0x00);
- }
-
- this->setCursor(0, this->line);
-}
-
-
-void PCD8544::setPower(bool on)
-{
- this->send(PCD8544_CMD, on ? 0x20 : 0x24);
-}
-
-
-inline void PCD8544::display()
-{
- this->setPower(true);
-}
-
-
-inline void PCD8544::noDisplay()
-{
- this->setPower(false);
-}
-
-
-void PCD8544::setInverse(bool inverse)
-{
- this->send(PCD8544_CMD, inverse ? 0x0d : 0x0c);
-}
-
-
-void PCD8544::home()
-{
- this->setCursor(0, this->line);
-}
-
-
-void PCD8544::setCursor(unsigned char column, unsigned char line)
-{
- if (column > PCD8544_WIDTH) {
- column = 0;
- line++;
- }
- if (line > PCD8544_HEIGHT / 8)
- line = 0;
-
- this->column = column;
- this->line = line;
-
- this->send(PCD8544_CMD, 0x80 | column);
- this->send(PCD8544_CMD, 0x40 | line);
-}
-
-
-void PCD8544::createChar(unsigned char chr, const unsigned char *glyph)
-{
- // ASCII 0-31 only...
- if (chr >= ' ') {
- return;
- }
-
- this->custom[chr] = glyph;
-}
-
-
-size_t PCD8544::write(uint8_t chr)
-{
- // ASCII 7-bit only...
- if (chr >= 0x7f) {
- return 0;
- }
-
- if (chr == '\n') {
- column = 0;
- line = (line + 1) % (PCD8544_HEIGHT/9 + 1);
- return 0;
- } else if (chr == '\r') {
- column = 0;
- return 0;
- }
-
- const unsigned char *glyph;
- unsigned char pgm_buffer[5];
-
- if (chr >= ' ') {
- // Regular ASCII characters are kept in flash to save RAM...
- memcpy_P(pgm_buffer, &font5x8[chr - ' '], sizeof(pgm_buffer));
- glyph = pgm_buffer;
- } else {
- // Custom glyphs, on the other hand, are stored in RAM...
- if (custom[chr]) {
- glyph = custom[chr];
- } else {
- // Default to a space character if unset...
- memcpy_P(pgm_buffer, &font5x8[0], sizeof(pgm_buffer));
- glyph = pgm_buffer;
- }
- }
-
- // Output one column at a time...
- for (unsigned char i = 0; i < 5; i++) {
- this->send(PCD8544_DATA, glyph[i]);
- }
-
- // One column between characters...
- this->send(PCD8544_DATA, 0x00);
-
- // Update the cursor position...
- this->column = (this->column + 6) % PCD8544_WIDTH;
-
- if (this->column == 0) {
- this->line = (this->line + 1) % (PCD8544_HEIGHT/9 + 1);
- }
-
-#if ARDUINO >= 100
- return 1;
-#endif
-}
-
-void PCD8544::draw8x8(const unsigned char *data)
-{
- // Output one column at a time...
- for (unsigned char i = 0; i < 8; i++) {
- this->send(PCD8544_DATA, data[i]);
- }
- this->setCursor(column + 8, line);
-}
-
-void PCD8544::draw16x16(const unsigned char *data)
-{
- unsigned char scolumn = this->column;
- unsigned char sline = this->line;
- // Output one column at a time...
- for (unsigned char i = 0; i < 16; i++) {
- this->send(PCD8544_DATA, data[i]);
- }
- this->setCursor(scolumn, sline + 1);
- for (unsigned char i = 0; i < 16; i++) {
- this->send(PCD8544_DATA, data[i + 16]);
- }
- // Update the cursor position...
- this->setCursor(scolumn + 16, sline);
-}
-
-void PCD8544::drawColumn(unsigned char lines, unsigned char value)
-{
- unsigned char scolumn = this->column;
- unsigned char sline = this->line;
-
- // Keep "value" within range...
- if (value > lines*8) {
- value = lines*8;
- }
-
- // Find the line where "value" resides...
- unsigned char mark = (lines*8 - 1 - value)/8;
-
- // Clear the lines above the mark...
- for (unsigned char line = 0; line < mark; line++) {
- this->setCursor(scolumn, sline + line);
- this->send(PCD8544_DATA, 0x00);
- }
-
- // Compute the byte to draw at the "mark" line...
- unsigned char b = 0xff;
- for (unsigned char i = 0; i < lines*8 - mark*8 - value; i++) {
- b <<= 1;
- }
-
- this->setCursor(scolumn, sline + mark);
- this->send(PCD8544_DATA, b);
-
- // Fill the lines below the mark...
- for (unsigned char line = mark + 1; line < lines; line++) {
- this->setCursor(scolumn, sline + line);
- this->send(PCD8544_DATA, 0xff);
- }
-
- // Leave the cursor in a consistent position...
- this->setCursor(scolumn + 1, sline);
-}
-
-
-void PCD8544::send(unsigned char type, unsigned char data)
-{
- digitalWrite(this->pin_dc, type);
-
- digitalWrite(this->pin_sce, LOW);
- shiftOut(this->pin_sdin, this->pin_sclk, MSBFIRST, data);
- digitalWrite(this->pin_sce, HIGH);
-}
-
-
-/* vim: set expandtab ts=4 sw=4: */
diff --git a/libraries/MultiLCD/PCD8544.h b/libraries/MultiLCD/PCD8544.h
deleted file mode 100644
index c96bc7e..0000000
--- a/libraries/MultiLCD/PCD8544.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * PCD8544 - Interface with Philips PCD8544 (or compatible) LCDs.
- *
- * Copyright (c) 2010 Carlos Rodrigues <cefrodrigues@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-
-#ifndef PCD8544_H
-#define PCD8544_H
-
-
-#if ARDUINO < 100
-#include <WProgram.h>
-#else
-#include <Arduino.h>
-#endif
-
-// Chip variants supported...
-#define CHIP_PCD8544 0
-#define CHIP_ST7576 1
-
-#define PCD8544_WIDTH 84
-#define PCD8544_HEIGHT 48
-
-#define PCD8544_CMD LOW
-#define PCD8544_DATA HIGH
-
-class PCD8544: public Print {
- public:
- // All the pins can be changed from the default values...
- PCD8544(unsigned char sclk = 2, /* clock (display pin 2) */
- unsigned char sdin = 3, /* data-in (display pin 3) */
- unsigned char dc = 4, /* data select (display pin 4) */
- unsigned char reset = 6, /* reset (display pin 8) */
- unsigned char sce = 5); /* enable (display pin 5) */
-
- // Display initialization (dimensions in pixels)...
- void begin(unsigned char model=CHIP_PCD8544);
- void stop();
-
- // Erase everything on the display...
- void clear();
- void clearLine(); // ...or just the current line
-
- // Control the display's power state...
- void setPower(bool on);
-
- // For compatibility with the LiquidCrystal library...
- void display();
- void noDisplay();
-
- // Activate white-on-black mode (whole display)...
- void setInverse(bool inverse);
-
- // Place the cursor at the start of the current line...
- void home();
-
- // Place the cursor at position (column, line)...
- void setCursor(unsigned char column, unsigned char line);
-
- // Assign a user-defined glyph (5x8) to an ASCII character (0-31)...
- void createChar(unsigned char chr, const unsigned char *glyph);
-
- // Write an ASCII character at the current cursor position (7-bit)...
-#if ARDUINO < 100
- virtual void write(uint8_t chr);
-#else
- virtual size_t write(uint8_t chr);
-#endif
-
- // Draw a chart element at the current cursor position...
- void drawColumn(unsigned char lines, unsigned char value);
-
- void draw8x8(const unsigned char *data);
- void draw16x16(const unsigned char *data);
-
- protected:
- // Current cursor position...
- unsigned char column;
- unsigned char line;
- // Send a command or data to the display...
- void send(unsigned char type, unsigned char data);
-
- private:
- unsigned char pin_sclk;
- unsigned char pin_sdin;
- unsigned char pin_dc;
- unsigned char pin_reset;
- unsigned char pin_sce;
-
- // User-defined glyphs (below the ASCII space character)...
- const unsigned char *custom[' '];
-};
-
-
-#endif /* PCD8544_H */
-
-
-/* vim: set expandtab ts=4 sw=4: */
diff --git a/libraries/MultiLCD/SH1106.cpp b/libraries/MultiLCD/SH1106.cpp
deleted file mode 100644
index 0496342..0000000
--- a/libraries/MultiLCD/SH1106.cpp
+++ /dev/null
@@ -1,401 +0,0 @@
-#include <Arduino.h>
-#include <Wire.h>
-#include "MultiLCD.h"
-
-#define I2C_ADDR 0x78 >> 1
-
-void LCD_SH1106::WriteCommand(unsigned char ins)
-{
- Wire.beginTransmission(I2C_ADDR);//0x78 >> 1
- Wire.write(0x00);//0x00
- Wire.write(ins);
- Wire.endTransmission();
-}
-
-void LCD_SH1106::WriteData(unsigned char dat)
-{
- Wire.beginTransmission(I2C_ADDR);//0x78 >> 1
- Wire.write(0x40);//0x40
- Wire.write(dat);
- Wire.endTransmission();
-}
-
-void LCD_SH1106::setCursor(unsigned char x, unsigned char y)
-{
- m_col = x + 2;
- m_row = y;
- WriteCommand(0xb0 + m_row);
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-}
-
-void LCD_SH1106::clear(byte x, byte y, byte width, byte height)
-{
- WriteCommand(SSD1306_SETLOWCOLUMN | 0x0); // low col = 0
- WriteCommand(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0
- WriteCommand(SSD1306_SETSTARTLINE | 0x0); // line #0
-
- // save I2C bitrate
- uint8_t twbrbackup = TWBR;
- TWBR = 18; // upgrade to 400KHz!
-
- height >>= 3;
- width >>= 3;
- y >>= 3;
- for (byte i = 0; i < height; i++) {
- // send a bunch of data in one xmission
- WriteCommand(0xB0 + i + y);//set page address
- WriteCommand((x + 2) & 0xf);//set lower column address
- WriteCommand(0x10 | (x >> 4));//set higher column address
-
- for(byte j = 0; j < 8; j++){
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (byte k = 0; k < width; k++) {
- Wire.write(0);
- }
- Wire.endTransmission();
- }
- }
-
- setCursor(0, 0);
- TWBR = twbrbackup;
-}
-
-size_t LCD_SH1106::write(uint8_t c)
-{
- if (c == '\n') {
- setCursor(0, m_row + ((m_font == FONT_SIZE_SMALL) ? 1 : 2));
- return 1;
- } else if (c == '\r') {
- m_col = 0;
- return 1;
- }
-
- uint8_t twbrbackup = TWBR;
- TWBR = 18; // upgrade to 400KHz!
-#ifndef MEMORY_SAVING
- if (m_font == FONT_SIZE_SMALL) {
-#endif
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- if (c > 0x20 && c < 0x7f) {
- c -= 0x21;
- for (byte i = 0; i < 5; i++) {
- byte d = pgm_read_byte(&font5x8[c][i]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.write(0);
- } else {
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 11 : 6; i > 0; i--) {
- Wire.write(0);
- }
- }
- Wire.endTransmission();
- m_col += (m_flags & FLAG_PIXEL_DOUBLE_H) ? 11 : 6;
- if (m_col >= 128) {
- m_col = 0;
- m_row ++;
- }
-#ifndef MEMORY_SAVING
- } else {
- if (c > 0x20 && c < 0x7f) {
- c -= 0x21;
-
- WriteCommand(0xB0 + m_row);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (byte i = 0; i <= 14; i += 2) {
- byte d = pgm_read_byte(&font8x16_terminal[c][i]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.endTransmission();
-
- WriteCommand(0xB0 + m_row + 1);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (byte i = 1; i <= 15; i += 2) {
- byte d = pgm_read_byte(&font8x16_terminal[c][i]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.endTransmission();
- } else {
- WriteCommand(0xB0 + m_row);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 16 : 8; i > 0; i--) {
- Wire.write(0);
- }
- Wire.endTransmission();
-
- WriteCommand(0xB0 + m_row + 1);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 16 : 8; i > 0; i--) {
- Wire.write(0);
- }
- Wire.endTransmission();
- }
- m_col += (m_flags & FLAG_PIXEL_DOUBLE_H) ? 17 : 9;
- if (m_col >= 128) {
- m_col = 0;
- m_row += 2;
- }
- }
-#endif
- TWBR = twbrbackup;
- return 1;
-}
-
-void LCD_SH1106::writeDigit(byte n)
-{
- uint8_t twbrbackup = TWBR;
- TWBR = 18; // upgrade to 400KHz!
-
- if (m_font == FONT_SIZE_SMALL) {
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- if (n <= 9) {
- n += '0' - 0x21;
- for (byte i = 0; i < 5; i++) {
- Wire.write(pgm_read_byte(&font5x8[n][i]));
- }
- Wire.write(0);
- } else {
- for (byte i = 0; i < 6; i++) {
- Wire.write(0);
- }
- }
- Wire.endTransmission();
- m_col += 6;
- } else if (m_font == FONT_SIZE_MEDIUM) {
- write(n <= 9 ? ('0' + n) : ' ');
-#ifndef MEMORY_SAVING
- } else if (m_font == FONT_SIZE_LARGE) {
- if (n <= 9) {
- byte i;
- WriteCommand(0xB0 + m_row);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (i = 0; i < 16; i ++) {
- byte d = pgm_read_byte(&digits16x16[n][i]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.endTransmission();
-
- WriteCommand(0xB0 + m_row + 1);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (; i < 32; i ++) {
- byte d = pgm_read_byte(&digits16x16[n][i]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.endTransmission();
- } else {
- WriteCommand(0xB0 + m_row);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 32 : 16; i > 0; i--) {
- Wire.write(0);
- }
- Wire.endTransmission();
-
- WriteCommand(0xB0 + m_row + 1);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 32 : 16; i > 0; i--) {
- Wire.write(0);
- }
- Wire.endTransmission();
- }
- m_col += (m_flags & FLAG_PIXEL_DOUBLE_H) ? 30 : 16;
-#endif
- } else {
- if (n <= 9) {
- byte i;
- WriteCommand(0xB0 + m_row);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (i = 0; i < 16; i ++) {
- byte d = pgm_read_byte(&digits16x24[n][i * 3]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.endTransmission();
-
- WriteCommand(0xB0 + m_row + 1);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (i = 0; i < 16; i ++) {
- byte d = pgm_read_byte(&digits16x24[n][i * 3 + 1]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.endTransmission();
-
- WriteCommand(0xB0 + m_row + 2);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (i = 0; i < 16; i ++) {
- byte d = pgm_read_byte(&digits16x24[n][i * 3 + 2]);
- Wire.write(d);
- if (m_flags & FLAG_PIXEL_DOUBLE_H) Wire.write(d);
- }
- Wire.endTransmission();
- } else {
- WriteCommand(0xB0 + m_row);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 32 : 16; i > 0; i--) {
- Wire.write(0);
- }
- Wire.endTransmission();
-
- WriteCommand(0xB0 + m_row + 1);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 32 : 16; i > 0; i--) {
- Wire.write(0);
- }
- Wire.endTransmission();
-
- WriteCommand(0xB0 + m_row + 2);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (byte i = (m_flags & FLAG_PIXEL_DOUBLE_H) ? 32 : 16; i > 0; i--) {
- Wire.write(0);
- }
- Wire.endTransmission();
- }
- m_col += (m_flags & FLAG_PIXEL_DOUBLE_H) ? 30 : 16;
- }
- TWBR = twbrbackup;
-}
-
-void LCD_SH1106::draw(const PROGMEM byte* buffer, byte width, byte height)
-{
- uint8_t twbrbackup = TWBR;
- TWBR = 18; // upgrade to 400KHz!
-
- WriteCommand(SSD1306_SETLOWCOLUMN | 0x0); // low col = 0
- WriteCommand(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0
- WriteCommand(SSD1306_SETSTARTLINE | 0x0); // line #0
-
- const PROGMEM byte *p = buffer;
- height >>= 3;
- width >>= 3;
- for (byte i = 0; i < height; i++) {
- // send a bunch of data in one xmission
- WriteCommand(0xB0 + i + m_row);//set page address
- WriteCommand(m_col & 0xf);//set lower column address
- WriteCommand(0x10 | (m_col >> 4));//set higher column address
-
- for(byte j = 0; j < 8; j++){
- Wire.beginTransmission(I2C_ADDR);
- Wire.write(0x40);
- for (byte k = 0; k < width; k++, p++) {
- Wire.write(pgm_read_byte(p));
- }
- Wire.endTransmission();
- }
- }
- TWBR = twbrbackup;
- m_col += width;
-}
-
-void LCD_SH1106::begin()
-{
- Wire.begin();
-
- WriteCommand(0xAE); /*display off*/
-
- WriteCommand(0x02); /*set lower column address*/
- WriteCommand(0x10); /*set higher column address*/
-
- WriteCommand(0x40); /*set display start line*/
-
- WriteCommand(0xB0); /*set page address*/
-
- WriteCommand(0x81); /*contract control*/
- WriteCommand(0x80); /*128*/
-
- WriteCommand(0xA1); /*set segment remap*/
-
- WriteCommand(0xA6); /*normal / reverse*/
-
- WriteCommand(0xA8); /*multiplex ratio*/
- WriteCommand(0x3F); /*duty = 1/32*/
-
- WriteCommand(0xad); /*set charge pump enable*/
- WriteCommand(0x8b); /*external VCC */
-
- WriteCommand(0x30); /*0X30---0X33 set VPP 9V liangdu!!!!*/
-
- WriteCommand(0xC8); /*Com scan direction*/
-
- WriteCommand(0xD3); /*set display offset*/
- WriteCommand(0x00); /* 0x20 */
-
- WriteCommand(0xD5); /*set osc division*/
- WriteCommand(0x80);
-
- WriteCommand(0xD9); /*set pre-charge period*/
- WriteCommand(0x1f); /*0x22*/
-
- WriteCommand(0xDA); /*set COM pins*/
- WriteCommand(0x12);
-
- WriteCommand(0xdb); /*set vcomh*/
- WriteCommand(0x40);
-
- WriteCommand(0xAF); /*display ON*/
-
- clear();
-}
diff --git a/libraries/MultiLCD/SSD1289.cpp b/libraries/MultiLCD/SSD1289.cpp
new file mode 100644
index 0000000..6552237
--- /dev/null
+++ b/libraries/MultiLCD/SSD1289.cpp
@@ -0,0 +1,393 @@
+/*************************************************************************
+* Arduino Text Display Library for Multiple LCDs
+* Distributed under GPL v2.0
+* Copyright (c) 2013 Stanley Huang <stanleyhuangyc@live.com>
+* All rights reserved.
+*************************************************************************/
+
+#include <Arduino.h>
+#include "MultiLCD.h"
+
+/**********************************************
+Define zone
+**********************************************/
+
+#define RS 59
+#define WR 58
+#define CS 57
+#define RST 56
+
+#define T_CLK 55
+#define T_CS 60
+#define T_DIN 54
+#define T_DOUT 8
+#define T_IRQ 9
+
+#define X_CONST 240
+#define Y_CONST 320
+
+#define PREC_TOUCH_CONST 10
+
+#define PixSizeX 13.78
+#define PixOffsX 411
+
+#define PixSizeY 11.01
+#define PixOffsY 378
+
+#define WINDOW_XADDR_START 0x0050 // Horizontal Start Address Set
+#define WINDOW_XADDR_END 0x0051 // Horizontal End Address Set
+#define WINDOW_YADDR_START 0x0052 // Vertical Start Address Set
+#define WINDOW_YADDR_END 0x0053 // Vertical End Address Set
+#define GRAM_XADDR 0x0020 // GRAM Horizontal Address Set
+#define GRAM_YADDR 0x0021 // GRAM Vertical Address Set
+#define GRAMWR 0x0022 // memory write
+
+/* LCD color */
+#define White 0xFFFF
+#define Black 0x0000
+#define Blue 0x001F
+#define Blue2 0x051F
+#define Red 0xF800
+#define Magenta 0xF81F
+#define Green 0x07E0
+#define Cyan 0x7FFF
+#define Yellow 0xFFE0
+
+/**********************************************
+Standard C functions zone
+**********************************************/
+void LCD_SSD1289::begin()
+{
+ delay(50);
+ pinMode(__p1,OUTPUT);
+ pinMode(__p2,OUTPUT);
+ pinMode(__p3,OUTPUT);
+ if (__p4 != NOTINUSE)
+ pinMode(__p4,OUTPUT);
+ if ((display_transfer_mode==LATCHED_16) or ((display_transfer_mode==1) and (display_serial_mode==SERIAL_5PIN)))
+ pinMode(__p5,OUTPUT);
+ if (display_transfer_mode!=1)
+ _set_direction_registers(display_transfer_mode);
+
+ _hw_special_init();
+
+ sbi(P_RST, B_RST);
+ delay(5);
+ cbi(P_RST, B_RST);
+ delay(15);
+ sbi(P_RST, B_RST);
+ delay(15);
+
+ setColor(0xffff);
+ setBackColor(0);
+ _transparent = false;
+
+ cbi(P_CS, B_CS);
+
+ LCD_Write_COM_DATA(0x00,0x0001);
+ LCD_Write_COM_DATA(0x03,0xA8A4);
+ LCD_Write_COM_DATA(0x0C,0x0000);
+ LCD_Write_COM_DATA(0x0D,0x080C);
+ LCD_Write_COM_DATA(0x0E,0x2B00);
+ LCD_Write_COM_DATA(0x1E,0x00B7);
+ LCD_Write_COM_DATA(0x01,0x2B3F);
+ LCD_Write_COM_DATA(0x02,0x0600);
+ LCD_Write_COM_DATA(0x10,0x0000);
+ LCD_Write_COM_DATA(0x11,0x6070);
+ LCD_Write_COM_DATA(0x05,0x0000);
+ LCD_Write_COM_DATA(0x06,0x0000);
+ LCD_Write_COM_DATA(0x16,0xEF1C);
+ LCD_Write_COM_DATA(0x17,0x0003);
+ LCD_Write_COM_DATA(0x07,0x0233);
+ LCD_Write_COM_DATA(0x0B,0x0000);
+ LCD_Write_COM_DATA(0x0F,0x0000);
+ LCD_Write_COM_DATA(0x41,0x0000);
+ LCD_Write_COM_DATA(0x42,0x0000);
+ LCD_Write_COM_DATA(0x48,0x0000);
+ LCD_Write_COM_DATA(0x49,0x013F);
+ LCD_Write_COM_DATA(0x4A,0x0000);
+ LCD_Write_COM_DATA(0x4B,0x0000);
+ LCD_Write_COM_DATA(0x44,0xEF00);
+ LCD_Write_COM_DATA(0x45,0x0000);
+ LCD_Write_COM_DATA(0x46,0x013F);
+ LCD_Write_COM_DATA(0x30,0x0707);
+ LCD_Write_COM_DATA(0x31,0x0204);
+ LCD_Write_COM_DATA(0x32,0x0204);
+ LCD_Write_COM_DATA(0x33,0x0502);
+ LCD_Write_COM_DATA(0x34,0x0507);
+ LCD_Write_COM_DATA(0x35,0x0204);
+ LCD_Write_COM_DATA(0x36,0x0204);
+ LCD_Write_COM_DATA(0x37,0x0502);
+ LCD_Write_COM_DATA(0x3A,0x0302);
+ LCD_Write_COM_DATA(0x3B,0x0302);
+ LCD_Write_COM_DATA(0x23,0x0000);
+ LCD_Write_COM_DATA(0x24,0x0000);
+ LCD_Write_COM_DATA(0x25,0x8000);
+ LCD_Write_COM_DATA(0x4f,0x0000);
+ LCD_Write_COM_DATA(0x4e,0x0000);
+ LCD_Write_COM(0x22);
+
+ sbi (P_CS, B_CS);
+
+ clear();
+}
+
+void LCD_SSD1289::setXY(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
+{
+ swap(word, x1, y1);
+ swap(word, x2, y2)
+ y1=disp_y_size-y1;
+ y2=disp_y_size-y2;
+ swap(word, y1, y2)
+ // begin hardware specific code
+ LCD_Write_COM_DATA(0x44,(x2<<8)+x1);
+ LCD_Write_COM_DATA(0x45,y1);
+ LCD_Write_COM_DATA(0x46,y2);
+ LCD_Write_COM_DATA(0x4e,x1);
+ LCD_Write_COM_DATA(0x4f,y1);
+ LCD_Write_COM(0x22);
+}
+
+void LCD_SSD1289::Enable()
+{
+ cbi(P_CS, B_CS);
+}
+void LCD_SSD1289::Disable()
+{
+ sbi(P_CS, B_CS);
+}
+
+void LCD_SSD1289::clearPixels(uint16_t pixels)
+{
+ do {
+ setPixel(bch, bcl);
+ } while(--pixels);
+}
+
+void LCD_SSD1289::clear()
+{
+ m_x = 0;
+ m_y = 0;
+ clrScr();
+}
+
+size_t LCD_SSD1289::write(uint8_t c)
+{
+ if (c == '\n') {
+ m_x += (m_font + 1) << 3;
+ return 0;
+ } else if (c == '\r') {
+ m_y = 0;
+ return 0;
+ }
+ if (m_x >= 320) return 0;
+ Enable();
+ if (m_font == FONT_SIZE_SMALL) {
+ setXY(m_x, m_y, m_x + 4, m_y + 7);
+ if (c > 0x20 && c < 0x7f) {
+ byte i = 4;
+ do {
+ unsigned char d = pgm_read_byte(&font5x8[c - 0x21][i]);
+ for (byte j = 0; j < 8; j++, d >>= 1) {
+ if (d & 1)
+ setPixel(fch, fcl);
+ else
+ setPixel(bch, bcl);
+ }
+ } while(i--);
+ } else {
+ clearPixels(5 * 8);
+ }
+ m_x += 6;
+ } else {
+ setXY(m_x, m_y, m_x + 7, m_y + 15);
+ if (c > 0x20 && c < 0x7f) {
+ byte pgm_buffer[16];
+ memcpy_P(pgm_buffer, &font8x16_terminal[c - 0x21], 16);
+ for (byte i = 0; i < 16; i += 2) {
+ unsigned char d = pgm_buffer[14 - i];
+ for (byte j = 0; j < 8; j++, d >>= 1) {
+ if (d & 1)
+ setPixel(fch, fcl);
+ else
+ setPixel(bch, bcl);
+ }
+ d = pgm_buffer[15 - i];
+ for (byte j = 0; j < 8; j++, d >>= 1) {
+ if (d & 1)
+ setPixel(fch, fcl);
+ else
+ setPixel(bch, bcl);
+ }
+ }
+ } else {
+ clearPixels(16 * 8);
+ }
+ m_x += 9;
+ }
+ Disable();
+}
+
+void LCD_SSD1289::writeDigit(byte n)
+{
+ Enable();
+ if (m_font == FONT_SIZE_SMALL) {
+ setXY(m_x, m_y, m_x + 7, m_y + 7);
+ if (n <= 9) {
+ byte pgm_buffer[8];
+ memcpy_P(pgm_buffer, &digits8x8[n], 8);
+ byte i = 7;
+ do {
+ unsigned char d = pgm_buffer[i];
+ for (byte j = 0; j < 8; j++, d >>= 1) {
+ if (d & 1)
+ setPixel(fch, fcl);
+ else
+ setPixel(bch, bcl);
+ }
+ } while (i--);
+
+ } else {
+ clearPixels(8 * 8);
+ }
+ m_x += 8;
+ } else if (m_font == FONT_SIZE_MEDIUM) {
+ write(n <= 9 ? ('0' + n) : ' ');
+ } else if (m_font == FONT_SIZE_LARGE) {
+ setXY(m_x, m_y, m_x + 15, m_y + 15);
+ if (n <= 9) {
+ byte pgm_buffer[32];
+ memcpy_P(pgm_buffer, &digits16x16[n], sizeof(pgm_buffer));
+ for (byte i = 0; i < 16; i++) {
+ unsigned char d = pgm_buffer[15 - i];
+ for (byte j = 0; j < 8; j++, d >>= 1) {
+ if (d & 1)
+ setPixel(fch, fcl);
+ else
+ setPixel(bch, bcl);
+ }
+ d = pgm_buffer[31 - i];
+ for (byte j = 0; j < 8; j++, d >>= 1) {
+ if (d & 1)
+ setPixel(fch, fcl);
+ else
+ setPixel(bch, bcl);
+ }
+ }
+ } else {
+ clearPixels(16 * 16);
+ }
+ m_x += 16;
+ } else if (m_font == FONT_SIZE_XLARGE) {
+ setXY(m_x, m_y, m_x + 15, m_y + 23);
+ if (n <= 9) {
+ byte pgm_buffer[48];
+ memcpy_P(pgm_buffer, &digits16x24[n], sizeof(pgm_buffer));
+ for (int i = 0; i < 48; i += 3) {
+ unsigned char d = pgm_buffer[45 - i];
+ for (int j = 0; j < 8; j++, d >>= 1) {
+ if (d & 1)
+ setPixel(fch, fcl);
+ else
+ setPixel(bch, bcl);
+ }
+ d = pgm_buffer[46 - i];
+ for (int j = 0; j < 8; j++, d >>= 1) {
+ if (d & 1)
+ setPixel(fch, fcl);
+ else
+ setPixel(bch, bcl);
+ }
+ d = pgm_buffer[47 - i];
+ for (int j = 0; j < 8; j++, d >>= 1) {
+ if (d & 1)
+ setPixel(fch, fcl);
+ else
+ setPixel(bch, bcl);
+ }
+ }
+ } else {
+ clearPixels(16 * 24);
+ }
+ m_x += 18;
+ }
+ Disable();
+}
+
+void LCD_SSD1289::draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height)
+{
+ byte rows = height >> 3;
+ Enable();
+ setXY(m_x, m_y, m_x + width - 1, m_y + height - 1);
+ for (int16_t i = width - 1; i >= 0; i--) {
+ for (uint8_t h = 0; h < rows; h++) {
+#ifndef __arm__
+ byte d = pgm_read_byte(buffer + i + width * h);
+#else
+ byte d = buffer[i + width * h];
+#endif
+ for (byte j = 0; j < 8; j++, d >>= 1) {
+ if (d & 1) {
+ setPixel(fch, fcl);
+ } else {
+ setPixel(bch, bcl);
+ }
+ }
+ }
+ }
+ Disable();
+ m_x += width;
+}
+
+void LCD_SSD1289::draw(const PROGMEM byte* buffer, uint16_t width, uint16_t height, byte scaleX, byte scaleY)
+{
+ byte rows = height >> 3;
+ if (scaleY == 0) scaleY = scaleX;
+ Enable();
+ setXY(m_x, m_y, m_x + width * scaleX - 1, m_y + height * scaleY - 1);
+ for (int16_t i = width - 1; i >= 0; i--) {
+ for (byte n = 0; n < scaleX; n++) {
+ for (uint8_t h = 0; h < rows; h++) {
+#ifndef __arm__
+ byte d = pgm_read_byte(buffer + i + width * h);
+#else
+ byte d = buffer[i + width * h];
+#endif
+ for (byte j = 0; j < 8; j++, d >>= 1) {
+ if (d & 1) {
+ for (byte m = 0; m < scaleY; m++) {
+ setPixel(fch, fcl);
+ }
+ } else {
+ for (byte m = 0; m < scaleY; m++) {
+ setPixel(bch, bcl);
+ }
+ }
+ }
+ }
+ }
+ }
+ Disable();
+ m_x += width * scaleX;
+}
+
+void LCD_SSD1289::draw4bpp(const PROGMEM byte* buffer, uint16_t width, uint16_t height)
+{
+ char buf[240];
+ Enable();
+ setXY(m_x, m_y, m_x + width * 2 - 1, m_y + height * 2 - 1);
+ uint16_t i = width - 1;
+ do {
+ memcpy_P(buf, buffer + i * height * 2, height * 2);
+ for (byte j = 0; j < height * 2; j += 2) {
+ setPixel(buf[j + 1], buf[j]);
+ setPixel(buf[j + 1], buf[j]);
+ }
+ for (byte j = 0; j < height * 2; j += 2) {
+ setPixel(buf[j + 1], buf[j]);
+ setPixel(buf[j + 1], buf[j]);
+ }
+ } while (i--);
+ Disable();
+ m_x += width * 2;
+}
diff --git a/libraries/MultiLCD/SSD1306.cpp b/libraries/MultiLCD/SSD1306.cpp
deleted file mode 100644
index 7b1c4f6..0000000
--- a/libraries/MultiLCD/SSD1306.cpp
+++ /dev/null
@@ -1,273 +0,0 @@
-#include <avr/pgmspace.h>
-//#include <util/delay.h>
-#include <stdlib.h>
-#include <Wire.h>
-#include "SSD1306.h"
-
-SSD1306::SSD1306(int8_t SCLK, int8_t DC, int8_t RST, int8_t CS) {
- cs = CS;
- rst = RST;
- dc = DC;
- sclk = SCLK;
-}
-
-// initializer for I2C - we only indicate the reset pin!
- SSD1306::SSD1306(int8_t reset) {
- sclk = dc = cs = -1;
- rst = reset;
-}
-
-
-void SSD1306::begin(uint8_t vccstate, uint8_t i2caddr) {
- _i2caddr = i2caddr;
-
-
- // set pin directions
- // I2C Init
- Wire.begin(); // Is this the right place for this?
-
- // Setup reset pin direction (used by both SPI and I2C)
- pinMode(rst, OUTPUT);
- digitalWrite(rst, HIGH);
- // VDD (3.3V) goes high at start, lets just chill for a ms
- delay(1);
- // bring reset low
- digitalWrite(rst, LOW);
- // wait 10ms
- delay(10);
- // bring out of reset
- digitalWrite(rst, HIGH);
- // turn on VCC (9V?)
- #if defined SSD1306_128_32
- // Init sequence for 128x32 OLED module
- ssd1306_command(SSD1306_DISPLAYOFF); // 0xAE
- ssd1306_command(SSD1306_SETDISPLAYCLOCKDIV); // 0xD5
- ssd1306_command(0x80); // the suggested ratio 0x80
- ssd1306_command(SSD1306_SETMULTIPLEX); // 0xA8
- ssd1306_command(0x1F);
- ssd1306_command(SSD1306_SETDISPLAYOFFSET); // 0xD3
- ssd1306_command(0x0); // no offset
- ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0
- ssd1306_command(SSD1306_CHARGEPUMP); // 0x8D
- if (vccstate == SSD1306_EXTERNALVCC)
- { ssd1306_command(0x10); }
- else
- { ssd1306_command(0x14); }
- ssd1306_command(SSD1306_MEMORYMODE); // 0x20
- ssd1306_command(0x00); // 0x0 act like ks0108
- ssd1306_command(SSD1306_SEGREMAP | 0x1);
- ssd1306_command(SSD1306_COMSCANDEC);
- ssd1306_command(SSD1306_SETCOMPINS); // 0xDA
- ssd1306_command(0x02);
- ssd1306_command(SSD1306_SETCONTRAST); // 0x81
- ssd1306_command(0x8F);
- ssd1306_command(SSD1306_SETPRECHARGE); // 0xd9
- if (vccstate == SSD1306_EXTERNALVCC)
- { ssd1306_command(0x22); }
- else
- { ssd1306_command(0xF1); }
- ssd1306_command(SSD1306_SETVCOMDETECT); // 0xDB
- ssd1306_command(0x40);
- ssd1306_command(SSD1306_DISPLAYALLON_RESUME); // 0xA4
- ssd1306_command(SSD1306_NORMALDISPLAY); // 0xA6
- #endif
-
- #if defined SSD1306_128_64
- // Init sequence for 128x64 OLED module
- ssd1306_command(SSD1306_DISPLAYOFF); // 0xAE
- ssd1306_command(SSD1306_SETDISPLAYCLOCKDIV); // 0xD5
- ssd1306_command(0x80); // the suggested ratio 0x80
- ssd1306_command(SSD1306_SETMULTIPLEX); // 0xA8
- ssd1306_command(0x3F);
- ssd1306_command(SSD1306_SETDISPLAYOFFSET); // 0xD3
- ssd1306_command(0x0); // no offset
- ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0
- ssd1306_command(SSD1306_CHARGEPUMP); // 0x8D
- if (vccstate == SSD1306_EXTERNALVCC)
- { ssd1306_command(0x10); }
- else
- { ssd1306_command(0x14); }
- ssd1306_command(SSD1306_MEMORYMODE); // 0x20
- ssd1306_command(0x00); // 0x0 act like ks0108
- ssd1306_command(SSD1306_SEGREMAP | 0x1);
- ssd1306_command(SSD1306_COMSCANDEC);
- ssd1306_command(SSD1306_SETCOMPINS); // 0xDA
- ssd1306_command(0x12);
- ssd1306_command(SSD1306_SETCONTRAST); // 0x81
- if (vccstate == SSD1306_EXTERNALVCC)
- { ssd1306_command(0x9F); }
- else
- { ssd1306_command(0xCF); }
- ssd1306_command(SSD1306_SETPRECHARGE); // 0xd9
- if (vccstate == SSD1306_EXTERNALVCC)
- { ssd1306_command(0x22); }
- else
- { ssd1306_command(0xF1); }
- ssd1306_command(SSD1306_SETVCOMDETECT); // 0xDB
- ssd1306_command(0x40);
- ssd1306_command(SSD1306_DISPLAYALLON_RESUME); // 0xA4
- ssd1306_command(SSD1306_NORMALDISPLAY); // 0xA6
- #endif
-
- ssd1306_command(SSD1306_DISPLAYON);//--turn on oled panel
-
- // clear screen
- delay(5);
-
- ssd1306_command(SSD1306_SETLOWCOLUMN | 0x0); // low col = 0
- ssd1306_command(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0
- ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0
-
- for (byte i = 0; i < SSD1306_LCDHEIGHT / 8; i++) {
- // send a bunch of data in one xmission
- ssd1306_command(0xB0 + i);//set page address
- ssd1306_command(0);//set lower column address
- ssd1306_command(0x10);//set higher column address
-
- for(byte j = 0; j < 8; j++){
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (byte k = 0; k < SSD1306_LCDWIDTH / 8; k++) {
- Wire.write(0);
- }
- Wire.endTransmission();
- }
- }
-}
-
-
-void SSD1306::invertDisplay(uint8_t i) {
- if (i) {
- ssd1306_command(SSD1306_INVERTDISPLAY);
- } else {
- ssd1306_command(SSD1306_NORMALDISPLAY);
- }
-}
-
-void SSD1306::ssd1306_command(uint8_t c) {
- // I2C
- uint8_t control = 0x00; // Co = 0, D/C = 0
- Wire.beginTransmission(_i2caddr);
- Wire.write(control);
- Wire.write(c);
- Wire.endTransmission();
-}
-
-// startscrollright
-// Activate a right handed scroll for rows start through stop
-// Hint, the display is 16 rows tall. To scroll the whole display, run:
-// display.scrollright(0x00, 0x0F)
-void SSD1306::startscrollright(uint8_t start, uint8_t stop){
- ssd1306_command(SSD1306_RIGHT_HORIZONTAL_SCROLL);
- ssd1306_command(0X00);
- ssd1306_command(start);
- ssd1306_command(0X00);
- ssd1306_command(stop);
- ssd1306_command(0X01);
- ssd1306_command(0XFF);
- ssd1306_command(SSD1306_ACTIVATE_SCROLL);
-}
-
-// startscrollleft
-// Activate a right handed scroll for rows start through stop
-// Hint, the display is 16 rows tall. To scroll the whole display, run:
-// display.scrollright(0x00, 0x0F)
-void SSD1306::startscrollleft(uint8_t start, uint8_t stop){
- ssd1306_command(SSD1306_LEFT_HORIZONTAL_SCROLL);
- ssd1306_command(0X00);
- ssd1306_command(start);
- ssd1306_command(0X00);
- ssd1306_command(stop);
- ssd1306_command(0X01);
- ssd1306_command(0XFF);
- ssd1306_command(SSD1306_ACTIVATE_SCROLL);
-}
-
-// startscrolldiagright
-// Activate a diagonal scroll for rows start through stop
-// Hint, the display is 16 rows tall. To scroll the whole display, run:
-// display.scrollright(0x00, 0x0F)
-void SSD1306::startscrolldiagright(uint8_t start, uint8_t stop){
- ssd1306_command(SSD1306_SET_VERTICAL_SCROLL_AREA);
- ssd1306_command(0X00);
- ssd1306_command(SSD1306_LCDHEIGHT);
- ssd1306_command(SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL);
- ssd1306_command(0X00);
- ssd1306_command(start);
- ssd1306_command(0X00);
- ssd1306_command(stop);
- ssd1306_command(0X01);
- ssd1306_command(SSD1306_ACTIVATE_SCROLL);
-}
-
-// startscrolldiagleft
-// Activate a diagonal scroll for rows start through stop
-// Hint, the display is 16 rows tall. To scroll the whole display, run:
-// display.scrollright(0x00, 0x0F)
-void SSD1306::startscrolldiagleft(uint8_t start, uint8_t stop){
- ssd1306_command(SSD1306_SET_VERTICAL_SCROLL_AREA);
- ssd1306_command(0X00);
- ssd1306_command(SSD1306_LCDHEIGHT);
- ssd1306_command(SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL);
- ssd1306_command(0X00);
- ssd1306_command(start);
- ssd1306_command(0X00);
- ssd1306_command(stop);
- ssd1306_command(0X01);
- ssd1306_command(SSD1306_ACTIVATE_SCROLL);
-}
-
-void SSD1306::stopscroll(void){
- ssd1306_command(SSD1306_DEACTIVATE_SCROLL);
-}
-
-void SSD1306::ssd1306_data(uint8_t c) {
- // I2C
- uint8_t control = 0x40; // Co = 0, D/C = 1
- Wire.beginTransmission(_i2caddr);
- Wire.write(control);
- Wire.write(c);
- Wire.endTransmission();
-}
-
-void SSD1306::fill(unsigned char dat)
-{
- unsigned char i,j;
-
- ssd1306_command(0x00);//set lower column address
- ssd1306_command(0x10);//set higher column address
- ssd1306_command(0xB0);//set page address
-
- uint8_t twbrbackup = TWBR;
- TWBR = 18; // upgrade to 400KHz!
- for (byte i=0; i<(SSD1306_LCDHEIGHT/8); i++)
- {
- // send a bunch of data in one xmission
- ssd1306_command(0xB0 + i);//set page address
- ssd1306_command(0);//set lower column address
- ssd1306_command(0x10);//set higher column address
-
- for(byte j = 0; j < 8; j++){
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- for (byte k = 0; k < 16; k++) {
- Wire.write(dat);
- }
- Wire.endTransmission();
- }
- }
- TWBR = twbrbackup;
-}
-
-void SSD1306::draw8x8(byte* buffer, uint8_t x, uint8_t y)
-{
- // send a bunch of data in one xmission
- ssd1306_command(0xB0 + y);//set page address
- ssd1306_command(x & 0xf);//set lower column address
- ssd1306_command(0x10 | (x >> 4));//set higher column address
-
- Wire.beginTransmission(_i2caddr);
- Wire.write(0x40);
- Wire.write(buffer, 8);
- Wire.endTransmission();
-}
diff --git a/libraries/MultiLCD/SSD1306.h b/libraries/MultiLCD/SSD1306.h
deleted file mode 100644
index ae7f339..0000000
--- a/libraries/MultiLCD/SSD1306.h
+++ /dev/null
@@ -1,112 +0,0 @@
-#include "Arduino.h"
-
-#define SSD1306_I2C_ADDRESS 0x3C // 011110+SA0+RW - 0x3C or 0x3D
-// Address for 128x32 is 0x3C
-// Address for 128x32 is 0x3D (default) or 0x3C (if SA0 is grounded)
-
-/*=========================================================================
- SSD1306 Displays
- -----------------------------------------------------------------------
- The driver is used in multiple displays (128x64, 128x32, etc.).
- Select the appropriate display below to create an appropriately
- sized framebuffer, etc.
-
- SSD1306_128_64 128x64 pixel display
-
- SSD1306_128_32 128x32 pixel display
-
- You also need to set the LCDWIDTH and LCDHEIGHT defines to an
- appropriate size
-
- -----------------------------------------------------------------------*/
- #define SSD1306_128_64
-// #define SSD1306_128_32
-/*=========================================================================*/
-
-#if defined SSD1306_128_64 && defined SSD1306_128_32
- #error "Only one SSD1306 display can be specified at once in SSD1306.h"
-#endif
-#if !defined SSD1306_128_64 && !defined SSD1306_128_32
- #error "At least one SSD1306 display must be specified in SSD1306.h"
-#endif
-
-#if defined SSD1306_128_64
- #define SSD1306_LCDWIDTH 128
- #define SSD1306_LCDHEIGHT 64
-#endif
-#if defined SSD1306_128_32
- #define SSD1306_LCDWIDTH 128
- #define SSD1306_LCDHEIGHT 32
-#endif
-
-#define SSD1306_SETCONTRAST 0x81
-#define SSD1306_DISPLAYALLON_RESUME 0xA4
-#define SSD1306_DISPLAYALLON 0xA5
-#define SSD1306_NORMALDISPLAY 0xA6
-#define SSD1306_INVERTDISPLAY 0xA7
-#define SSD1306_DISPLAYOFF 0xAE
-#define SSD1306_DISPLAYON 0xAF
-
-#define SSD1306_SETDISPLAYOFFSET 0xD3
-#define SSD1306_SETCOMPINS 0xDA
-
-#define SSD1306_SETVCOMDETECT 0xDB
-
-#define SSD1306_SETDISPLAYCLOCKDIV 0xD5
-#define SSD1306_SETPRECHARGE 0xD9
-
-#define SSD1306_SETMULTIPLEX 0xA8
-
-#define SSD1306_SETLOWCOLUMN 0x00
-#define SSD1306_SETHIGHCOLUMN 0x10
-
-#define SSD1306_SETSTARTLINE 0x40
-
-#define SSD1306_MEMORYMODE 0x20
-
-#define SSD1306_COMSCANINC 0xC0
-#define SSD1306_COMSCANDEC 0xC8
-
-#define SSD1306_SEGREMAP 0xA0
-
-#define SSD1306_CHARGEPUMP 0x8D
-
-#define SSD1306_EXTERNALVCC 0x1
-#define SSD1306_SWITCHCAPVCC 0x2
-
-// Scrolling #defines
-#define SSD1306_ACTIVATE_SCROLL 0x2F
-#define SSD1306_DEACTIVATE_SCROLL 0x2E
-#define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3
-#define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26
-#define SSD1306_LEFT_HORIZONTAL_SCROLL 0x27
-#define SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL 0x29
-#define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A
-
-class SSD1306 {
-public:
- SSD1306(int8_t SCLK, int8_t DC, int8_t RST, int8_t CS);
- SSD1306(int8_t RST = 4);
-
- void begin(uint8_t switchvcc = SSD1306_SWITCHCAPVCC, uint8_t i2caddr = SSD1306_I2C_ADDRESS);
- void ssd1306_command(uint8_t c);
- void ssd1306_data(uint8_t c);
-
- void invertDisplay(uint8_t i);
- void draw8x8(byte* buffer, byte x, byte y);
-
- void startscrollright(uint8_t start, uint8_t stop);
- void startscrollleft(uint8_t start, uint8_t stop);
-
- void startscrolldiagright(uint8_t start, uint8_t stop);
- void startscrolldiagleft(uint8_t start, uint8_t stop);
- void stopscroll(void);
-
- void fill(unsigned char dat);
- void clearBuffer();
-
-protected:
- uint8_t _i2caddr;
-private:
- int8_t sclk, dc, rst, cs;
-};
diff --git a/libraries/MultiLCD/UTFT.cpp b/libraries/MultiLCD/UTFT.cpp
new file mode 100644
index 0000000..59710e9
--- /dev/null
+++ b/libraries/MultiLCD/UTFT.cpp
@@ -0,0 +1,985 @@
+/*
+ UTFT.cpp - Arduino/chipKit library support for Color TFT LCD Boards
+ Copyright (C)2010-2014 Henning Karlsen. All right reserved
+
+ This library is the continuation of my ITDB02_Graph, ITDB02_Graph16
+ and RGB_GLCD libraries for Arduino and chipKit. As the number of
+ supported display modules and controllers started to increase I felt
+ it was time to make a single, universal library as it will be much
+ easier to maintain in the future.
+
+ Basic functionality of this library was origianlly based on the
+ demo-code provided by ITead studio (for the ITDB02 modules) and
+ NKC Electronics (for the RGB GLCD module/shield).
+
+ This library supports a number of 8bit, 16bit and serial graphic
+ displays, and will work with both Arduino and chipKit boards. For a
+ full list of tested display modules and controllers, see the
+ document UTFT_Supported_display_modules_&_controllers.pdf.
+
+ When using 8bit and 16bit display modules there are some
+ requirements you must adhere to. These requirements can be found
+ in the document UTFT_Requirements.pdf.
+ There are no special requirements when using serial displays.
+
+ You can always find the latest version of the library at
+ http://electronics.henningkarlsen.com/
+
+ If you make any modifications or improvements to the code, I would
+ appreciate that you share the code with me so that I might include
+ it in the next release. I can be contacted through
+ http://electronics.henningkarlsen.com/contact.php.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the CC BY-NC-SA 3.0 license.
+ Please see the included documents for further information.
+
+ Commercial use of this library requires you to buy a license that
+ will allow commercial use. This includes using the library,
+ modified or not, as a tool to sell products.
+
+ The license applies to all part of the library including the
+ examples and tools supplied with the library.
+*/
+
+#include "UTFT.h"
+#include <pins_arduino.h>
+
+// Include hardware-specific functions for the correct MCU
+#if defined(__AVR__)
+ #include <avr/pgmspace.h>
+ #include "hardware/avr/HW_AVR.h"
+ #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
+ #include "hardware/avr/HW_ATmega1280.h"
+ #elif defined(__AVR_ATmega328P__)
+ #include "hardware/avr/HW_ATmega328P.h"
+ #elif defined(__AVR_ATmega32U4__)
+ #include "hardware/avr/HW_ATmega32U4.h"
+ #elif defined(__AVR_ATmega168__)
+ #error "ATmega168 MCUs are not supported because they have too little flash memory!"
+ #elif defined(__AVR_ATmega1284P__)
+ #include "hardware/avr/HW_ATmega1284P.h"
+ #else
+ #error "Unsupported AVR MCU!"
+ #endif
+#elif defined(__PIC32MX__)
+ #include "hardware/pic32/HW_PIC32.h"
+ #if defined(__32MX320F128H__)
+ #pragma message("Compiling for chipKIT UNO32 (PIC32MX320F128H)")
+ #include "hardware/pic32/HW_PIC32MX320F128H.h"
+ #elif defined(__32MX340F512H__)
+ #pragma message("Compiling for chipKIT uC32 (PIC32MX340F512H)")
+ #include "hardware/pic32/HW_PIC32MX340F512H.h"
+ #elif defined(__32MX795F512L__)
+ #pragma message("Compiling for chipKIT MAX32 (PIC32MX795F512L)")
+ #include "hardware/pic32/HW_PIC32MX795F512L.h"
+ #else
+ #error "Unsupported PIC32 MCU!"
+ #endif
+#elif defined(__arm__)
+ #include "hardware/arm/HW_ARM.h"
+ #if defined(__SAM3X8E__)
+ #pragma message("Compiling for Arduino Due (AT91SAM3X8E)...")
+ #include "hardware/arm/HW_SAM3X8E.h"
+ #elif defined(__MK20DX128__) || defined(__MK20DX256__)
+ #pragma message("Compiling for Teensy 3.x (MK20DX128VLH7 / MK20DX256VLH7)...")
+ #include "hardware/arm/HW_MX20DX256.h"
+ #else
+ #error "Unsupported ARM MCU!"
+ #endif
+#endif
+#include "memorysaver.h"
+
+UTFT::UTFT()
+{
+}
+
+UTFT::UTFT(byte model, int RS, int WR, int CS, int RST, int SER)
+{
+ word dsx[] = {239, 239, 239, 239, 239, 239, 175, 175, 239, 127, 127, 239, 271, 479, 239, 239, 239, 239, 239, 239, 479, 319, 239, 175, 127, 239, 239, 319, 319, 799, 127};
+ word dsy[] = {319, 399, 319, 319, 319, 319, 219, 219, 399, 159, 127, 319, 479, 799, 319, 319, 319, 319, 319, 319, 799, 479, 319, 219, 159, 319, 319, 479, 479, 479, 159};
+ byte dtm[] = {16, 16, 16, 8, 8, 16, 8, SERIAL_4PIN, 16, SERIAL_5PIN, SERIAL_5PIN, 16, 16, 16, 8, 16, LATCHED_16, 8, 16, 8, 16, 16, 16, 8, SERIAL_5PIN, SERIAL_5PIN, SERIAL_4PIN, 16, 16, 16, SERIAL_5PIN};
+
+ disp_x_size = dsx[model];
+ disp_y_size = dsy[model];
+ display_transfer_mode = dtm[model];
+ display_model = model;
+
+ __p1 = RS;
+ __p2 = WR;
+ __p3 = CS;
+ __p4 = RST;
+ __p5 = SER;
+
+ if (display_transfer_mode == SERIAL_4PIN)
+ {
+ display_transfer_mode=1;
+ display_serial_mode=SERIAL_4PIN;
+ }
+ if (display_transfer_mode == SERIAL_5PIN)
+ {
+ display_transfer_mode=1;
+ display_serial_mode=SERIAL_5PIN;
+ }
+
+ if (display_transfer_mode!=1)
+ {
+ P_RS = portOutputRegister(digitalPinToPort(RS));
+ B_RS = digitalPinToBitMask(RS);
+ P_WR = portOutputRegister(digitalPinToPort(WR));
+ B_WR = digitalPinToBitMask(WR);
+ P_CS = portOutputRegister(digitalPinToPort(CS));
+ B_CS = digitalPinToBitMask(CS);
+ P_RST = portOutputRegister(digitalPinToPort(RST));
+ B_RST = digitalPinToBitMask(RST);
+ if (display_transfer_mode==LATCHED_16)
+ {
+ P_ALE = portOutputRegister(digitalPinToPort(SER));
+ B_ALE = digitalPinToBitMask(SER);
+ cbi(P_ALE, B_ALE);
+ pinMode(8,OUTPUT);
+ digitalWrite(8, LOW);
+ }
+ }
+ else
+ {
+ P_SDA = portOutputRegister(digitalPinToPort(RS));
+ B_SDA = digitalPinToBitMask(RS);
+ P_SCL = portOutputRegister(digitalPinToPort(WR));
+ B_SCL = digitalPinToBitMask(WR);
+ P_CS = portOutputRegister(digitalPinToPort(CS));
+ B_CS = digitalPinToBitMask(CS);
+ if (RST != NOTINUSE)
+ {
+ P_RST = portOutputRegister(digitalPinToPort(RST));
+ B_RST = digitalPinToBitMask(RST);
+ }
+ if (display_serial_mode!=SERIAL_4PIN)
+ {
+ P_RS = portOutputRegister(digitalPinToPort(SER));
+ B_RS = digitalPinToBitMask(SER);
+ }
+ }
+}
+
+void UTFT::LCD_Write_COM(char VL)
+{
+ if (display_transfer_mode!=1)
+ {
+ cbi(P_RS, B_RS);
+ LCD_Writ_Bus(0x00,VL,display_transfer_mode);
+ }
+ else
+ LCD_Writ_Bus(0x00,VL,display_transfer_mode);
+}
+
+void UTFT::LCD_Write_DATA(char VH,char VL)
+{
+ if (display_transfer_mode!=1)
+ {
+ sbi(P_RS, B_RS);
+ LCD_Writ_Bus(VH,VL,display_transfer_mode);
+ }
+ else
+ {
+ LCD_Writ_Bus(0x01,VH,display_transfer_mode);
+ LCD_Writ_Bus(0x01,VL,display_transfer_mode);
+ }
+}
+
+void UTFT::LCD_Write_DATA(char VL)
+{
+ if (display_transfer_mode!=1)
+ {
+ sbi(P_RS, B_RS);
+ LCD_Writ_Bus(0x00,VL,display_transfer_mode);
+ }
+ else
+ LCD_Writ_Bus(0x01,VL,display_transfer_mode);
+}
+
+void UTFT::LCD_Write_COM_DATA(char com1,int dat1)
+{
+ LCD_Write_COM(com1);
+ LCD_Write_DATA(dat1>>8,dat1);
+}
+
+void UTFT::InitLCD()
+{
+ pinMode(__p1,OUTPUT);
+ pinMode(__p2,OUTPUT);
+ pinMode(__p3,OUTPUT);
+ if (__p4 != NOTINUSE)
+ pinMode(__p4,OUTPUT);
+ if ((display_transfer_mode==LATCHED_16) or ((display_transfer_mode==1) and (display_serial_mode==SERIAL_5PIN)))
+ pinMode(__p5,OUTPUT);
+ if (display_transfer_mode!=1)
+ _set_direction_registers(display_transfer_mode);
+
+ _hw_special_init();
+
+ sbi(P_RST, B_RST);
+ delay(5);
+ cbi(P_RST, B_RST);
+ delay(15);
+ sbi(P_RST, B_RST);
+ delay(15);
+
+ cbi(P_CS, B_CS);
+
+ switch(display_model)
+ {
+#ifndef DISABLE_HX8347A
+ #include "tft_drivers/hx8347a/initlcd.h"
+#endif
+#ifndef DISABLE_ILI9327
+ #include "tft_drivers/ili9327/initlcd.h"
+#endif
+#ifndef DISABLE_SSD1289
+ #include "tft_drivers/ssd1289/initlcd.h"
+#endif
+#ifndef DISABLE_ILI9325C
+ #include "tft_drivers/ili9325c/initlcd.h"
+#endif
+#ifndef DISABLE_ILI9325D
+ #include "tft_drivers/ili9325d/default/initlcd.h"
+#endif
+#ifndef DISABLE_ILI9325D_ALT
+ #include "tft_drivers/ili9325d/alt/initlcd.h"
+#endif
+#ifndef DISABLE_HX8340B_8
+ #include "tft_drivers/hx8340b/8/initlcd.h"
+#endif
+#ifndef DISABLE_HX8340B_S
+ #include "tft_drivers/hx8340b/s/initlcd.h"
+#endif
+#ifndef DISABLE_ST7735
+ #include "tft_drivers/st7735/initlcd.h"
+#endif
+#ifndef DISABLE_PCF8833
+ #include "tft_drivers/pcf8833/initlcd.h"
+#endif
+#ifndef DISABLE_S1D19122
+ #include "tft_drivers/s1d19122/initlcd.h"
+#endif
+#ifndef DISABLE_HX8352A
+ #include "tft_drivers/hx8352a/initlcd.h"
+#endif
+#ifndef DISABLE_SSD1963_480
+ #include "tft_drivers/ssd1963/480/initlcd.h"
+#endif
+#ifndef DISABLE_SSD1963_800
+ #include "tft_drivers/ssd1963/800/initlcd.h"
+#endif
+#ifndef DISABLE_SSD1963_800_ALT
+ #include "tft_drivers/ssd1963/800alt/initlcd.h"
+#endif
+#ifndef DISABLE_S6D1121
+ #include "tft_drivers/s6d1121/initlcd.h"
+#endif
+#ifndef DISABLE_ILI9320
+ #include "tft_drivers/ili9320/initlcd.h"
+#endif
+#ifndef DISABLE_ILI9481
+ #include "tft_drivers/ili9481/initlcd.h"
+#endif
+#ifndef DISABLE_S6D0164
+ #include "tft_drivers/s6d0164/initlcd.h"
+#endif
+#ifndef DISABLE_ST7735S
+ #include "tft_drivers/st7735s/initlcd.h"
+#endif
+#ifndef DISABLE_ILI9341_S4P
+ #include "tft_drivers/ili9341/s4p/initlcd.h"
+#endif
+#ifndef DISABLE_ILI9341_S5P
+ #include "tft_drivers/ili9341/s5p/initlcd.h"
+#endif
+#ifndef DISABLE_R61581
+ #include "tft_drivers/r61581/initlcd.h"
+#endif
+#ifndef DISABLE_ILI9486
+ #include "tft_drivers/ili9486/initlcd.h"
+#endif
+#ifndef DISABLE_CPLD
+ #include "tft_drivers/cpld/initlcd.h"
+#endif
+#ifndef DISABLE_HX8353C
+ #include "tft_drivers/hx8353c/initlcd.h"
+#endif
+ }
+
+ sbi (P_CS, B_CS);
+
+ setColor(0xffff);
+ setBackColor(0);
+ cfont.font=0;
+ _transparent = false;
+}
+
+void UTFT::setXY(word x1, word y1, word x2, word y2)
+{
+ swap(word, x1, y1);
+ swap(word, x2, y2)
+ y1=disp_y_size-y1;
+ y2=disp_y_size-y2;
+ swap(word, y1, y2)
+
+ switch(display_model)
+ {
+#ifndef DISABLE_HX8347A
+ #include "tft_drivers/hx8347a/setxy.h"
+#endif
+#ifndef DISABLE_HX8352A
+ #include "tft_drivers/hx8352a/setxy.h"
+#endif
+#ifndef DISABLE_ILI9327
+ #include "tft_drivers/ili9327/setxy.h"
+#endif
+#ifndef DISABLE_SSD1289
+ #include "tft_drivers/ssd1289/setxy.h"
+#endif
+#ifndef DISABLE_ILI9325C
+ #include "tft_drivers/ili9325c/setxy.h"
+#endif
+#ifndef DISABLE_ILI9325D
+ #include "tft_drivers/ili9325d/default/setxy.h"
+#endif
+#ifndef DISABLE_ILI9325D_ALT
+ #include "tft_drivers/ili9325d/alt/setxy.h"
+#endif
+#ifndef DISABLE_HX8340B_8
+ #include "tft_drivers/hx8340b/8/setxy.h"
+#endif
+#ifndef DISABLE_HX8340B_S
+ #include "tft_drivers/hx8340b/s/setxy.h"
+#endif
+#ifndef DISABLE_ST7735
+ #include "tft_drivers/st7735/setxy.h"
+#endif
+#ifndef DISABLE_S1D19122
+ #include "tft_drivers/s1d19122/setxy.h"
+#endif
+#ifndef DISABLE_PCF8833
+ #include "tft_drivers/pcf8833/setxy.h"
+#endif
+#ifndef DISABLE_SSD1963_480
+ #include "tft_drivers/ssd1963/480/setxy.h"
+#endif
+#ifndef DISABLE_SSD1963_800
+ #include "tft_drivers/ssd1963/800/setxy.h"
+#endif
+#ifndef DISABLE_SSD1963_800_ALT
+ #include "tft_drivers/ssd1963/800alt/setxy.h"
+#endif
+#ifndef DISABLE_S6D1121
+ #include "tft_drivers/s6d1121/setxy.h"
+#endif
+#ifndef DISABLE_ILI9320
+ #include "tft_drivers/ili9320/setxy.h"
+#endif
+#ifndef DISABLE_ILI9481
+ #include "tft_drivers/ili9481/setxy.h"
+#endif
+#ifndef DISABLE_S6D0164
+ #include "tft_drivers/s6d0164/setxy.h"
+#endif
+#ifndef DISABLE_ST7735S
+ #include "tft_drivers/st7735s/setxy.h"
+#endif
+#ifndef DISABLE_ILI9341_S4P
+ #include "tft_drivers/ili9341/s4p/setxy.h"
+#endif
+#ifndef DISABLE_ILI9341_S5P
+ #include "tft_drivers/ili9341/s5p/setxy.h"
+#endif
+#ifndef DISABLE_R61581
+ #include "tft_drivers/r61581/setxy.h"
+#endif
+#ifndef DISABLE_ILI9486
+ #include "tft_drivers/ili9486/setxy.h"
+#endif
+#ifndef DISABLE_CPLD
+ #include "tft_drivers/cpld/setxy.h"
+#endif
+#ifndef DISABLE_HX8353C
+ #include "tft_drivers/hx8353c/setxy.h"
+#endif
+ }
+}
+
+void UTFT::clrXY()
+{
+ setXY(0,0,disp_y_size,disp_x_size);
+}
+
+void UTFT::drawRect(int x1, int y1, int x2, int y2)
+{
+ if (x1>x2)
+ {
+ swap(int, x1, x2);
+ }
+ if (y1>y2)
+ {
+ swap(int, y1, y2);
+ }
+
+ drawHLine(x1, y1, x2-x1);
+ drawHLine(x1, y2, x2-x1);
+ drawVLine(x1, y1, y2-y1);
+ drawVLine(x2, y1, y2-y1);
+}
+
+void UTFT::drawRoundRect(int x1, int y1, int x2, int y2)
+{
+ if (x1>x2)
+ {
+ swap(int, x1, x2);
+ }
+ if (y1>y2)
+ {
+ swap(int, y1, y2);
+ }
+ if ((x2-x1)>4 && (y2-y1)>4)
+ {
+ drawPixel(x1+1,y1+1);
+ drawPixel(x2-1,y1+1);
+ drawPixel(x1+1,y2-1);
+ drawPixel(x2-1,y2-1);
+ drawHLine(x1+2, y1, x2-x1-4);
+ drawHLine(x1+2, y2, x2-x1-4);
+ drawVLine(x1, y1+2, y2-y1-4);
+ drawVLine(x2, y1+2, y2-y1-4);
+ }
+}
+
+void UTFT::fillRect(int x1, int y1, int x2, int y2)
+{
+ if (x1>x2)
+ {
+ swap(int, x1, x2);
+ }
+ if (y1>y2)
+ {
+ swap(int, y1, y2);
+ }
+ if (display_transfer_mode==16)
+ {
+ cbi(P_CS, B_CS);
+ setXY(x1, y1, x2, y2);
+ sbi(P_RS, B_RS);
+ _fast_fill_16(fch,fcl,((long(x2-x1)+1)*(long(y2-y1)+1)));
+ sbi(P_CS, B_CS);
+ }
+ else if ((display_transfer_mode==8) and (fch==fcl))
+ {
+ cbi(P_CS, B_CS);
+ setXY(x1, y1, x2, y2);
+ sbi(P_RS, B_RS);
+ _fast_fill_8(fch,((long(x2-x1)+1)*(long(y2-y1)+1)));
+ sbi(P_CS, B_CS);
+ }
+ else
+ {
+
+ for (int i=0; i<((x2-x1)/2)+1; i++)
+ {
+ drawVLine(x1+i, y1, y2-y1);
+ drawVLine(x2-i, y1, y2-y1);
+ }
+ }
+}
+
+void UTFT::fillRoundRect(int x1, int y1, int x2, int y2)
+{
+ if (x1>x2)
+ {
+ swap(int, x1, x2);
+ }
+ if (y1>y2)
+ {
+ swap(int, y1, y2);
+ }
+
+ if ((x2-x1)>4 && (y2-y1)>4)
+ {
+ for (int i=0; i<((y2-y1)/2)+1; i++)
+ {
+ switch(i)
+ {
+ case 0:
+ drawHLine(x1+2, y1+i, x2-x1-4);
+ drawHLine(x1+2, y2-i, x2-x1-4);
+ break;
+ case 1:
+ drawHLine(x1+1, y1+i, x2-x1-2);
+ drawHLine(x1+1, y2-i, x2-x1-2);
+ break;
+ default:
+ drawHLine(x1, y1+i, x2-x1);
+ drawHLine(x1, y2-i, x2-x1);
+ }
+ }
+ }
+}
+
+void UTFT::drawCircle(int x, int y, int radius)
+{
+ int f = 1 - radius;
+ int ddF_x = 1;
+ int ddF_y = -2 * radius;
+ int x1 = 0;
+ int y1 = radius;
+
+ cbi(P_CS, B_CS);
+ setXY(x, y + radius, x, y + radius);
+ LCD_Write_DATA(fch,fcl);
+ setXY(x, y - radius, x, y - radius);
+ LCD_Write_DATA(fch,fcl);
+ setXY(x + radius, y, x + radius, y);
+ LCD_Write_DATA(fch,fcl);
+ setXY(x - radius, y, x - radius, y);
+ LCD_Write_DATA(fch,fcl);
+
+ while(x1 < y1)
+ {
+ if(f >= 0)
+ {
+ y1--;
+ ddF_y += 2;
+ f += ddF_y;
+ }
+ x1++;
+ ddF_x += 2;
+ f += ddF_x;
+ setXY(x + x1, y + y1, x + x1, y + y1);
+ LCD_Write_DATA(fch,fcl);
+ setXY(x - x1, y + y1, x - x1, y + y1);
+ LCD_Write_DATA(fch,fcl);
+ setXY(x + x1, y - y1, x + x1, y - y1);
+ LCD_Write_DATA(fch,fcl);
+ setXY(x - x1, y - y1, x - x1, y - y1);
+ LCD_Write_DATA(fch,fcl);
+ setXY(x + y1, y + x1, x + y1, y + x1);
+ LCD_Write_DATA(fch,fcl);
+ setXY(x - y1, y + x1, x - y1, y + x1);
+ LCD_Write_DATA(fch,fcl);
+ setXY(x + y1, y - x1, x + y1, y - x1);
+ LCD_Write_DATA(fch,fcl);
+ setXY(x - y1, y - x1, x - y1, y - x1);
+ LCD_Write_DATA(fch,fcl);
+ }
+ sbi(P_CS, B_CS);
+ clrXY();
+}
+
+void UTFT::fillCircle(int x, int y, int radius)
+{
+ for(int y1=-radius; y1<=0; y1++)
+ for(int x1=-radius; x1<=0; x1++)
+ if(x1*x1+y1*y1 <= radius*radius)
+ {
+ drawHLine(x+x1, y+y1, 2*(-x1));
+ drawHLine(x+x1, y-y1, 2*(-x1));
+ break;
+ }
+}
+
+void UTFT::clrScr()
+{
+ long i;
+
+ cbi(P_CS, B_CS);
+ clrXY();
+ if (display_transfer_mode!=1)
+ sbi(P_RS, B_RS);
+ if (display_transfer_mode==16)
+ _fast_fill_16(0,0,((disp_x_size+1)*(disp_y_size+1)));
+ else if (display_transfer_mode==8)
+ _fast_fill_8(0,((disp_x_size+1)*(disp_y_size+1)));
+ else
+ {
+ for (i=0; i<((disp_x_size+1)*(disp_y_size+1)); i++)
+ {
+ if (display_transfer_mode!=1)
+ LCD_Writ_Bus(0,0,display_transfer_mode);
+ else
+ {
+ LCD_Writ_Bus(1,0,display_transfer_mode);
+ LCD_Writ_Bus(1,0,display_transfer_mode);
+ }
+ }
+ }
+ sbi(P_CS, B_CS);
+}
+
+void UTFT::fillScr(byte r, byte g, byte b)
+{
+ word color = ((r&248)<<8 | (g&252)<<3 | (b&248)>>3);
+ fillScr(color);
+}
+
+void UTFT::fillScr(word color)
+{
+ long i;
+ char ch, cl;
+
+ ch=byte(color>>8);
+ cl=byte(color & 0xFF);
+
+ cbi(P_CS, B_CS);
+ clrXY();
+ if (display_transfer_mode!=1)
+ sbi(P_RS, B_RS);
+ if (display_transfer_mode==16)
+ _fast_fill_16(ch,cl,((disp_x_size+1)*(disp_y_size+1)));
+ else if ((display_transfer_mode==8) and (ch==cl))
+ _fast_fill_8(ch,((disp_x_size+1)*(disp_y_size+1)));
+ else
+ {
+ for (i=0; i<((disp_x_size+1)*(disp_y_size+1)); i++)
+ {
+ if (display_transfer_mode!=1)
+ LCD_Writ_Bus(ch,cl,display_transfer_mode);
+ else
+ {
+ LCD_Writ_Bus(1,ch,display_transfer_mode);
+ LCD_Writ_Bus(1,cl,display_transfer_mode);
+ }
+ }
+ }
+ sbi(P_CS, B_CS);
+}
+
+void UTFT::setColor(byte r, byte g, byte b)
+{
+ fch=((r&248)|g>>5);
+ fcl=((g&28)<<3|b>>3);
+}
+
+void UTFT::setColor(word color)
+{
+ fch=byte(color>>8);
+ fcl=byte(color & 0xFF);
+}
+
+word UTFT::getColor()
+{
+ return (fch<<8) | fcl;
+}
+
+void UTFT::setBackColor(byte r, byte g, byte b)
+{
+ bch=((r&248)|g>>5);
+ bcl=((g&28)<<3|b>>3);
+ _transparent=false;
+}
+
+void UTFT::setBackColor(word color)
+{
+ bch=byte(color>>8);
+ bcl=byte(color & 0xFF);
+ _transparent=false;
+}
+
+word UTFT::getBackColor()
+{
+ return (bch<<8) | bcl;
+}
+
+void UTFT::setPixel(word color)
+{
+ LCD_Write_DATA((color>>8),(color&0xFF)); // rrrrrggggggbbbbb
+}
+
+void UTFT::setPixel(char ch, char cl)
+{
+ LCD_Write_DATA(ch,cl); // rrrrrggggggbbbbb
+}
+
+void UTFT::drawPixel(int x, int y)
+{
+ cbi(P_CS, B_CS);
+ setXY(x, y, x, y);
+ setPixel(fch, fcl);
+ sbi(P_CS, B_CS);
+ //clrXY();
+}
+
+void UTFT::drawLine(int x1, int y1, int x2, int y2)
+{
+ if (y1==y2)
+ drawHLine(x1, y1, x2-x1);
+ else if (x1==x2)
+ drawVLine(x1, y1, y2-y1);
+ else
+ {
+ unsigned int dx = (x2 > x1 ? x2 - x1 : x1 - x2);
+ short xstep = x2 > x1 ? 1 : -1;
+ unsigned int dy = (y2 > y1 ? y2 - y1 : y1 - y2);
+ short ystep = y2 > y1 ? 1 : -1;
+ int col = x1, row = y1;
+
+ cbi(P_CS, B_CS);
+ if (dx < dy)
+ {
+ int t = - (dy >> 1);
+ while (true)
+ {
+ setXY (col, row, col, row);
+ LCD_Write_DATA (fch, fcl);
+ if (row == y2)
+ return;
+ row += ystep;
+ t += dx;
+ if (t >= 0)
+ {
+ col += xstep;
+ t -= dy;
+ }
+ }
+ }
+ else
+ {
+ int t = - (dx >> 1);
+ while (true)
+ {
+ setXY (col, row, col, row);
+ LCD_Write_DATA (fch, fcl);
+ if (col == x2)
+ return;
+ col += xstep;
+ t += dy;
+ if (t >= 0)
+ {
+ row += ystep;
+ t -= dx;
+ }
+ }
+ }
+ sbi(P_CS, B_CS);
+ }
+ clrXY();
+}
+
+void UTFT::drawHLine(int x, int y, int l)
+{
+ if (l<0)
+ {
+ l = -l;
+ x -= l;
+ }
+ cbi(P_CS, B_CS);
+ setXY(x, y, x+l, y);
+ if (display_transfer_mode == 16)
+ {
+ sbi(P_RS, B_RS);
+ _fast_fill_16(fch,fcl,l);
+ }
+ else if ((display_transfer_mode==8) and (fch==fcl))
+ {
+ sbi(P_RS, B_RS);
+ _fast_fill_8(fch,l);
+ }
+ else
+ {
+ for (int i=0; i<l+1; i++)
+ {
+ LCD_Write_DATA(fch, fcl);
+ }
+ }
+ sbi(P_CS, B_CS);
+ clrXY();
+}
+
+void UTFT::drawVLine(int x, int y, int l)
+{
+ if (l<0)
+ {
+ l = -l;
+ y -= l;
+ }
+ cbi(P_CS, B_CS);
+ setXY(x, y, x, y+l);
+ if (display_transfer_mode == 16)
+ {
+ sbi(P_RS, B_RS);
+ _fast_fill_16(fch,fcl,l);
+ }
+ else if ((display_transfer_mode==8) and (fch==fcl))
+ {
+ sbi(P_RS, B_RS);
+ _fast_fill_8(fch,l);
+ }
+ else
+ {
+ for (int i=0; i<l+1; i++)
+ {
+ LCD_Write_DATA(fch, fcl);
+ }
+ }
+ sbi(P_CS, B_CS);
+ clrXY();
+}
+
+size_t UTFT::write(byte c)
+{
+ byte i,ch;
+ word j;
+ word temp;
+
+ if (c < ' ') {
+ if (c == '\r') {
+ m_x = 0;
+ } else if (c == '\n') {
+ m_y += cfont.y_size;
+ }
+ return 1;
+ }
+
+ cbi(P_CS, B_CS);
+
+ if (!_transparent)
+ {
+ temp=((c-cfont.offset)*((cfont.x_size/8)*cfont.y_size))+4;
+
+ for(j=0;j<((cfont.x_size/8)*cfont.y_size);j+=(cfont.x_size/8))
+ {
+ setXY(m_x,m_y+(j/(cfont.x_size/8)),m_x+cfont.x_size-1,m_y+(j/(cfont.x_size/8)));
+ for (int zz=(cfont.x_size/8)-1; zz>=0; zz--)
+ {
+ ch=pgm_read_byte(&cfont.font[temp+zz]);
+ for(i=0;i<8;i++)
+ {
+ if((ch&(1<<i))!=0)
+ {
+ setPixel(fch, fcl);
+ }
+ else
+ {
+ setPixel(bch, bcl);
+ }
+ }
+ }
+ temp+=(cfont.x_size/8);
+ }
+ }
+ else
+ {
+ temp=((c-cfont.offset)*((cfont.x_size/8)*cfont.y_size))+4;
+ for(j=0;j<cfont.y_size;j++)
+ {
+ for (int zz=0; zz<(cfont.x_size/8); zz++)
+ {
+ ch=pgm_read_byte(&cfont.font[temp+zz]);
+ for(i=0;i<8;i++)
+ {
+ setXY(m_x+i+(zz*8),m_y+j,m_x+i+(zz*8)+1,m_y+j+1);
+
+ if((ch&(1<<(7-i)))!=0)
+ {
+ setPixel(fch, fcl);
+ }
+ }
+ }
+ temp+=(cfont.x_size/8);
+ }
+ }
+
+ sbi(P_CS, B_CS);
+ clrXY();
+ m_x += cfont.x_size;
+ return 1;
+}
+
+void UTFT::setFont(uint8_t* font)
+{
+ cfont.font=font;
+ cfont.x_size=fontbyte(0);
+ cfont.y_size=fontbyte(1);
+ cfont.offset=fontbyte(2);
+ cfont.numchars=fontbyte(3);
+}
+
+uint8_t* UTFT::getFont()
+{
+ return cfont.font;
+}
+
+uint8_t UTFT::getFontXsize()
+{
+ return cfont.x_size;
+}
+
+uint8_t UTFT::getFontYsize()
+{
+ return cfont.y_size;
+}
+
+void UTFT::drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int scale)
+{
+ unsigned int col;
+ int tx, ty, tc, tsx, tsy;
+
+ if (scale==1)
+ {
+ cbi(P_CS, B_CS);
+ for (ty=0; ty<sy; ty++)
+ {
+ setXY(x, y+ty, x+sx-1, y+ty);
+ for (tx=sx-1; tx>=0; tx--)
+ {
+ col=pgm_read_word(&data[(ty*sx)+tx]);
+ LCD_Write_DATA(col>>8,col & 0xff);
+ }
+ }
+ sbi(P_CS, B_CS);
+ }
+ else
+ {
+ cbi(P_CS, B_CS);
+ for (ty=0; ty<sy; ty++)
+ {
+ for (tsy=0; tsy<scale; tsy++)
+ {
+ setXY(x, y+(ty*scale)+tsy, x+((sx*scale)-1), y+(ty*scale)+tsy);
+ for (tx=sx-1; tx>=0; tx--)
+ {
+ col=pgm_read_word(&data[(ty*sx)+tx]);
+ for (tsx=0; tsx<scale; tsx++)
+ LCD_Write_DATA(col>>8,col & 0xff);
+ }
+ }
+ }
+ sbi(P_CS, B_CS);
+ }
+ clrXY();
+}
+
+void UTFT::drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int deg, int rox, int roy)
+{
+ unsigned int col;
+ int tx, ty, newx, newy;
+ double radian;
+ radian=deg*0.0175;
+
+ if (deg==0)
+ drawBitmap(x, y, sx, sy, data);
+ else
+ {
+ cbi(P_CS, B_CS);
+ for (ty=0; ty<sy; ty++)
+ for (tx=0; tx<sx; tx++)
+ {
+ col=pgm_read_word(&data[(ty*sx)+tx]);
+
+ newx=x+rox+(((tx-rox)*cos(radian))-((ty-roy)*sin(radian)));
+ newy=y+roy+(((ty-roy)*cos(radian))+((tx-rox)*sin(radian)));
+
+ setXY(newx, newy, newx, newy);
+ LCD_Write_DATA(col>>8,col & 0xff);
+ }
+ sbi(P_CS, B_CS);
+ }
+ clrXY();
+}
diff --git a/libraries/MultiLCD/UTFT.h b/libraries/MultiLCD/UTFT.h
new file mode 100644
index 0000000..6e0c8cb
--- /dev/null
+++ b/libraries/MultiLCD/UTFT.h
@@ -0,0 +1,275 @@
+/*
+ UTFT.h - Arduino/chipKit library support for Color TFT LCD Boards
+ Copyright (C)2010-2014 Henning Karlsen. All right reserved
+
+ This library is the continuation of my ITDB02_Graph, ITDB02_Graph16
+ and RGB_GLCD libraries for Arduino and chipKit. As the number of
+ supported display modules and controllers started to increase I felt
+ it was time to make a single, universal library as it will be much
+ easier to maintain in the future.
+
+ Basic functionality of this library was origianlly based on the
+ demo-code provided by ITead studio (for the ITDB02 modules) and
+ NKC Electronics (for the RGB GLCD module/shield).
+
+ This library supports a number of 8bit, 16bit and serial graphic
+ displays, and will work with both Arduino and chipKit boards. For a
+ full list of tested display modules and controllers, see the
+ document UTFT_Supported_display_modules_&_controllers.pdf.
+
+ When using 8bit and 16bit display modules there are some
+ requirements you must adhere to. These requirements can be found
+ in the document UTFT_Requirements.pdf.
+ There are no special requirements when using serial displays.
+
+ You can always find the latest version of the library at
+ http://electronics.henningkarlsen.com/
+
+ If you make any modifications or improvements to the code, I would
+ appreciate that you share the code with me so that I might include
+ it in the next release. I can be contacted through
+ http://electronics.henningkarlsen.com/contact.php.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the CC BY-NC-SA 3.0 license.
+ Please see the included documents for further information.
+
+ Commercial use of this library requires you to buy a license that
+ will allow commercial use. This includes using the library,
+ modified or not, as a tool to sell products.
+
+ The license applies to all part of the library including the
+ examples and tools supplied with the library.
+*/
+
+#ifndef UTFT_h
+#define UTFT_h
+
+#define UTFT_VERSION 276
+
+#define LEFT 0
+#define RIGHT 9999
+#define CENTER 9998
+
+#define PORTRAIT 0
+#define LANDSCAPE 1
+
+#define HX8347A 0
+#define ILI9327 1
+#define SSD1289 2
+#define ILI9325C 3
+#define ILI9325D_8 4
+#define ILI9325D_16 5
+#define HX8340B_8 6
+#define HX8340B_S 7
+#define HX8352A 8
+#define ST7735 9
+#define PCF8833 10
+#define S1D19122 11
+#define SSD1963_480 12
+#define SSD1963_800 13
+#define S6D1121_8 14
+#define S6D1121_16 15
+#define SSD1289LATCHED 16
+#define ILI9320_8 17
+#define ILI9320_16 18
+#define SSD1289_8 19
+#define SSD1963_800ALT 20
+#define ILI9481 21
+#define ILI9325D_16ALT 22
+#define S6D0164 23
+#define ST7735S 24
+#define ILI9341_S5P 25
+#define ILI9341_S4P 26
+#define R61581 27
+#define ILI9486 28
+#define CPLD 29
+#define HX8353C 30
+
+#define ITDB32 0 // HX8347-A (16bit)
+#define ITDB32WC 1 // ILI9327 (16bit)
+#define TFT01_32W 1 // ILI9327 (16bit)
+#define ITDB32S 2 // SSD1289 (16bit)
+#define TFT01_32 2 // SSD1289 (16bit)
+#define CTE32 2 // SSD1289 (16bit)
+#define GEEE32 2 // SSD1289 (16bit)
+#define ITDB24 3 // ILI9325C (8bit)
+#define ITDB24D 4 // ILI9325D (8bit)
+#define ITDB24DWOT 4 // ILI9325D (8bit)
+#define ITDB28 4 // ILI9325D (8bit)
+#define TFT01_24_8 4 // ILI9325D (8bit)
+#define DMTFT24104 4 // ILI9325D (8bit)
+#define DMTFT28103 4 // ILI9325D (8bit)
+#define TFT01_24_16 5 // ILI9325D (16bit)
+#define ITDB22 6 // HX8340-B (8bit)
+#define GEEE22 6 // HX8340-B (8bit)
+#define ITDB22SP 7 // HX8340-B (Serial 4Pin)
+#define ITDB32WD 8 // HX8352-A (16bit)
+#define TFT01_32WD 8 // HX8352-A (16bit)
+#define CTE32W 8 // HX8352-A (16bit)
+#define ITDB18SP 9 // ST7735 (Serial 5Pin)
+#define LPH9135 10 // PCF8833 (Serial 5Pin)
+#define ITDB25H 11 // S1D19122 (16bit)
+#define ITDB43 12 // SSD1963 (16bit) 480x272
+#define TFT01_43 12 // SSD1963 (16bit) 480x272
+#define ITDB50 13 // SSD1963 (16bit) 800x480
+#define TFT01_50 13 // SSD1963 (16bit) 800x480
+#define CTE50 13 // SSD1963 (16bit) 800x480
+#define EHOUSE50 13 // SSD1963 (16bit) 800x480
+#define ITDB24E_8 14 // S6D1121 (8bit)
+#define TFT01_24R2 14 // S6D1121 (8bit)
+#define ITDB24E_16 15 // S6D1121 (16bit)
+#define INFINIT32 16 // SSD1289 (Latched 16bit) -- Legacy, will be removed later
+#define ELEE32_REVA 16 // SSD1289 (Latched 16bit)
+#define GEEE24 17 // ILI9320 (8bit)
+#define GEEE28 18 // ILI9320 (16bit)
+#define ELEE32_REVB 19 // SSD1289 (8bit)
+#define TFT01_70 20 // SSD1963 (16bit) 800x480 Alternative Init
+#define CTE70 20 // SSD1963 (16bit) 800x480 Alternative Init
+#define EHOUSE70 20 // SSD1963 (16bit) 800x480 Alternative Init
+#define CTE32HR 21 // ILI9481 (16bit)
+#define CTE28 22 // ILI9325D (16bit) Alternative Init
+#define TFT01_28 22 // ILI9325D (16bit) Alternative Init
+#define CTE22 23 // S6D0164 (8bit)
+#define TFT01_22 23 // S6D0164 (8bit)
+#define DMTFT22102 23 // S6D0164 (8bit)
+#define TFT01_18SP 24 // ST7735S (Serial 5Pin)
+#define TFT01_22SP 25 // ILI9341 (Serial 5Pin)
+#define DMTFT28105 25 // ILI9341 (Serial 5Pin)
+#define MI0283QT9 26 // ILI9341 (Serial 4Pin)
+#define CTE35IPS 27 // R61581 (16bit)
+#define CTE40 28 // ILI9486 (16bit)
+#define EHOUSE50CPLD 29 // CPLD (16bit)
+#define CTE50CPLD 29 // CPLD (16bit)
+#define CTE70CPLD 29 // CPLD (16bit)
+#define DMTFT18101 30 // HX8353C (Serial 5Pin)
+
+
+#define SERIAL_4PIN 4
+#define SERIAL_5PIN 5
+#define LATCHED_16 17
+
+#define NOTINUSE 255
+
+//*********************************
+// COLORS
+//*********************************
+// VGA color palette
+#define VGA_BLACK 0x0000
+#define VGA_WHITE 0xFFFF
+#define VGA_RED 0xF800
+#define VGA_GREEN 0x0400
+#define VGA_BLUE 0x001F
+#define VGA_SILVER 0xC618
+#define VGA_GRAY 0x8410
+#define VGA_MAROON 0x8000
+#define VGA_YELLOW 0xFFE0
+#define VGA_OLIVE 0x8400
+#define VGA_LIME 0x07E0
+#define VGA_AQUA 0x07FF
+#define VGA_TEAL 0x0410
+#define VGA_NAVY 0x0010
+#define VGA_FUCHSIA 0xF81F
+#define VGA_PURPLE 0x8010
+#define VGA_TRANSPARENT 0xFFFFFFFF
+
+#if defined(__AVR__)
+ #include "Arduino.h"
+ #include "hardware/avr/HW_AVR_defines.h"
+#elif defined(__PIC32MX__)
+ #include "WProgram.h"
+ #include "hardware/pic32/HW_PIC32_defines.h"
+#elif defined(__arm__)
+ #include "Arduino.h"
+ #include "hardware/arm/HW_ARM_defines.h"
+#endif
+
+struct _current_font
+{
+ uint8_t* font;
+ uint8_t x_size;
+ uint8_t y_size;
+ uint8_t offset;
+ uint8_t numchars;
+};
+
+class UTFT : public Print
+{
+ public:
+ UTFT();
+ UTFT(byte model, int RS, int WR, int CS, int RST, int SER=0);
+ void InitLCD();
+ void clrScr();
+ void drawPixel(int x, int y);
+ void drawLine(int x1, int y1, int x2, int y2);
+ void fillScr(byte r, byte g, byte b);
+ void fillScr(word color);
+ void drawRect(int x1, int y1, int x2, int y2);
+ void drawRoundRect(int x1, int y1, int x2, int y2);
+ void fillRect(int x1, int y1, int x2, int y2);
+ void fillRoundRect(int x1, int y1, int x2, int y2);
+ void drawCircle(int x, int y, int radius);
+ void fillCircle(int x, int y, int radius);
+ void setColor(byte r, byte g, byte b);
+ void setColor(word color);
+ word getColor();
+ void setBackColor(byte r, byte g, byte b);
+ void setBackColor(word color);
+ word getBackColor();
+ void setTransparent(bool transparent)
+ {
+ _transparent = transparent;
+ }
+ void setFont(uint8_t* font);
+ uint8_t* getFont();
+ uint8_t getFontXsize();
+ uint8_t getFontYsize();
+ void drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int scale=1);
+ void drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int deg, int rox, int roy);
+ virtual void setXY(int x, int y)
+ {
+ m_x = x;
+ m_y = y;
+ }
+ virtual size_t write(byte c);
+
+ int m_x;
+ int m_y;
+
+/*
+ The functions and variables below should not normally be used.
+ They have been left publicly available for use in add-on libraries
+ that might need access to the lower level functions of UTFT.
+
+ Please note that these functions and variables are not documented
+ and I do not provide support on how to use them.
+*/
+ byte fcl, fch, bcl, bch;
+ word disp_x_size, disp_y_size;
+ byte display_model, display_transfer_mode, display_serial_mode;
+ regtype *P_RS, *P_WR, *P_CS, *P_RST, *P_SDA, *P_SCL, *P_ALE;
+ regsize B_RS, B_WR, B_CS, B_RST, B_SDA, B_SCL, B_ALE;
+ byte __p1, __p2, __p3, __p4, __p5;
+ _current_font cfont;
+ boolean _transparent;
+
+ void LCD_Writ_Bus(char VH,char VL, byte mode);
+ void LCD_Write_COM(char VL);
+ void LCD_Write_DATA(char VH,char VL);
+ void LCD_Write_DATA(char VL);
+ void LCD_Write_COM_DATA(char com1,int dat1);
+ void _hw_special_init();
+ void setPixel(word color);
+ void setPixel(char ch, char cl);
+ void drawHLine(int x, int y, int l);
+ void drawVLine(int x, int y, int l);
+ virtual void setXY(word x1, word y1, word x2, word y2);
+ void clrXY();
+ void rotateChar(byte c, int x, int y, int pos, int deg);
+ void _set_direction_registers(byte mode);
+ void _fast_fill_16(int ch, int cl, long pix);
+ void _fast_fill_8(int ch, long pix);
+ void _convert_float(char *buf, double num, int width, byte prec);
+};
+
+#endif
diff --git a/libraries/MultiLCD/fonts.cpp b/libraries/MultiLCD/fonts.h
index 2f33655..ab83ba3 100644
--- a/libraries/MultiLCD/fonts.cpp
+++ b/libraries/MultiLCD/fonts.h
@@ -1,47 +1,5 @@
-#include <Arduino.h>
-#include "MultiLCD.h"
-
-const PROGMEM unsigned char digits16x24[][48] = {
-{0x00,0x00,0x00,0xF0,0xFF,0x0F,0xFC,0xFF,0x3F,0xFE,0xFF,0x7F,0xFE,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0x7F,0xFE,0xFF,0x7F,0xFC,0xFF,0x3F,0xF0,0xFF,0x0F},/*"0",0*/
-{0x00,0x00,0x00,0x70,0x00,0x00,0x70,0x00,0x00,0x70,0x00,0x00,0x78,0x00,0x00,0xF8,0x00,0x00,0xFC,0xFF,0xFF,0xFE,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"1",0*/
-{0x00,0x00,0x00,0xF8,0x00,0xE0,0xFC,0x00,0xF8,0xFE,0x00,0xFE,0xFE,0x80,0xFF,0xFF,0xC0,0xFF,0x07,0xF0,0xFF,0x07,0xFC,0xFF,0x07,0xFF,0xEF,0xFF,0xFF,0xE3,0xFF,0xFF,0xE1,0xFE,0x7F,0xE0,0xFE,0x3F,0xE0,0xFC,0x0F,0xE0,0xF0,0x03,0x00,0x00,0x00,0x00},/*"2",2*/
-{0x00,0x00,0x00,0xF8,0x80,0x1F,0xFE,0x80,0x3F,0xFE,0x80,0x7F,0xFF,0x80,0x7F,0xFF,0x80,0xFF,0xFF,0x9C,0xFF,0xFF,0x9C,0xFF,0x07,0x1C,0xE0,0x07,0x3E,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0x7F,0xFE,0xF7,0x7F,0xFC,0xF7,0x3F,0xF0,0xE3,0x1F},/*"3",3*/
-{0x00,0xF0,0x0F,0x00,0xFE,0x0F,0x80,0xFF,0x0F,0xE0,0xFF,0x0F,0xFC,0xBF,0x0F,0xFF,0x87,0x0F,0xFF,0x81,0x0F,0x3F,0x80,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x80,0x0F,0x00,0x80,0x0F},/*"4",4*/
-{0x00,0x00,0x00,0xFF,0xC7,0x0F,0xFF,0xC7,0x3F,0xFF,0xC7,0x7F,0xFF,0xC7,0x7F,0xFF,0xC7,0xFF,0xFF,0xC7,0xFF,0x87,0x01,0xE0,0xC7,0x01,0xE0,0xC7,0x01,0xE0,0xC7,0xFF,0xFF,0xC7,0xFF,0xFF,0xC7,0xFF,0x7F,0x87,0xFF,0x7F,0x87,0xFF,0x3F,0x07,0xFE,0x1F},/*"5",5*/
-{0x00,0x00,0x00,0xF0,0xFF,0x0F,0xFC,0xFF,0x3F,0xFE,0xFF,0x7F,0xFE,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x06,0xE0,0x07,0x07,0xE0,0x07,0x07,0xE0,0x3F,0xFF,0xFF,0x3F,0xFF,0xFF,0x3E,0xFF,0x7F,0x3E,0xFE,0x7F,0x3C,0xFE,0x3F,0x38,0xF8,0x1F},/*"6",6*/
-{0x00,0x00,0x00,0x07,0x00,0x00,0x07,0x00,0x00,0x07,0x00,0xC0,0x07,0x00,0xF8,0x07,0x00,0xFF,0x07,0xE0,0xFF,0x07,0xFE,0xFF,0xC7,0xFF,0xFF,0xFF,0xFF,0x3F,0xFF,0xFF,0x07,0xFF,0xFF,0x00,0xFF,0x0F,0x00,0xFF,0x01,0x00,0x1F,0x00,0x00,0x00,0x00,0x00},/*"7",1*/
-{0x00,0x00,0x00,0xF0,0xE3,0x1F,0xFC,0xF7,0x3F,0xFE,0xFF,0x7F,0xFE,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x1C,0xE0,0x07,0x1C,0xE0,0x07,0x1C,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0x7F,0xFE,0xF7,0x7F,0xFC,0xF7,0x3F,0xF0,0xE3,0x1F},/*"8",8*/
-{0x00,0x00,0x00,0xF8,0x1F,0x1C,0xFC,0x7F,0x3C,0xFE,0x7F,0x7C,0xFE,0xFF,0x7C,0xFF,0xFF,0xFC,0xFF,0xFF,0xFC,0x07,0xE0,0xE0,0x07,0xE0,0xE0,0x07,0x60,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0x7F,0xFE,0xFF,0x7F,0xFC,0xFF,0x3F,0xF0,0xFF,0x0F},/*"9",9*/
-};
-
-const PROGMEM unsigned char digits16x16[][32] = {
-{0x00,0xE0,0xF8,0xFC,0xFE,0x1E,0x07,0x07,0x07,0x07,0x1E,0xFE,0xFC,0xF8,0xF0,0x00,0x00,0x07,0x0F,0x3F,0x3F,0x7C,0x70,0x70,0x70,0x70,0x7C,0x3F,0x1F,0x1F,0x07,0x00},/*0*/
-{0x00,0x00,0x00,0x06,0x07,0x07,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x7F,0x00,0x00,0x00,0x00,0x00,0x00},/*1*/
-{0x00,0x38,0x3C,0x3E,0x3E,0x0F,0x07,0x07,0x07,0xCF,0xFF,0xFE,0xFE,0x38,0x00,0x00,0x00,0x40,0x40,0x60,0x70,0x78,0x7C,0x7E,0x7F,0x77,0x73,0x71,0x70,0x70,0x00,0x00},/*2*/
-{0x00,0x18,0x1C,0x1E,0x1E,0x0F,0xC7,0xC7,0xE7,0xFF,0xFE,0xBE,0x9C,0x00,0x00,0x00,0x00,0x0C,0x1C,0x3C,0x3C,0x78,0x70,0x70,0x70,0x79,0x7F,0x3F,0x1F,0x0F,0x00,0x00},/*3*/
-{0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,0x1E,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x06,0x07,0x07,0x07,0x06,0x06,0x06,0x06,0x06,0x7F,0x7F,0x7F,0x7F,0x06,0x06,0x00},/*4*/
-{0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xE7,0xE7,0xE7,0xE7,0xC7,0x87,0x00,0x00,0x00,0x00,0x38,0x78,0x71,0x70,0x70,0x70,0x70,0x70,0x39,0x3F,0x3F,0x1F,0x0F,0x00},/*5*/
-{0x00,0x80,0xE0,0xF0,0xF8,0xFC,0x7F,0x7F,0x6F,0x67,0xE1,0xE1,0xC0,0x80,0x00,0x00,0x00,0x0F,0x1F,0x3F,0x3F,0x78,0x70,0x70,0x70,0x70,0x78,0x3F,0x3F,0x1F,0x0F,0x00},/*6*/
-{0x00,0x07,0x07,0x07,0x07,0x07,0xC7,0xE7,0xF7,0xFF,0x7F,0x3F,0x1F,0x07,0x03,0x01,0x00,0x20,0x38,0x7C,0x7E,0x3F,0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*7*/
-{0x00,0x00,0x00,0x1C,0xBE,0xFE,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFE,0xBE,0x1C,0x00,0x00,0x00,0x0E,0x3F,0x3F,0x7F,0x71,0x60,0x60,0x60,0x71,0x7F,0x3F,0x3F,0x0F,0x00},/*8*/
-{0x00,0x78,0xFC,0xFE,0xFE,0x8F,0x07,0x07,0x07,0x07,0x8F,0xFE,0xFE,0xFC,0xF8,0x00,0x00,0x00,0x00,0x01,0x43,0x43,0x73,0x7B,0x7F,0x7F,0x1F,0x0F,0x07,0x03,0x00,0x00},/*9*/
-};
-
-const PROGMEM unsigned char digits8x8[][8] = {
-{0x3C,0x7E,0x83,0x81,0x81,0x7E,0x3C,0x00},/*0*/
-{0x84,0x84,0x82,0xFF,0xFF,0x80,0x80,0x00},/*1*/
-{0x84,0xC6,0xE1,0xA1,0xB1,0x9F,0x8E,0x00},/*2*/
-{0x42,0xC3,0x81,0x89,0x89,0xFF,0x76,0x00},/*3*/
-{0x20,0x38,0x24,0x22,0xFF,0xFF,0x20,0x00},/*4*/
-{0x5F,0xDF,0x99,0x89,0x89,0xF9,0x70,0x00},/*5*/
-{0x3C,0x7E,0x89,0x89,0x89,0xFB,0x72,0x00},/*6*/
-{0x01,0x01,0xE1,0xF9,0x1D,0x07,0x01,0x00},/*7*/
-{0x6E,0xFF,0x89,0x89,0x99,0xFF,0x76,0x00},/*8*/
-{0x4E,0xDF,0x91,0x91,0x91,0x7F,0x3E,0x00},/*9*/
-};
-
// The 7-bit ASCII character set...
-const PROGMEM unsigned char font5x8[][5] = {
+const unsigned char font5x8[][5] PROGMEM = {
{ 0x00, 0x00, 0x5f, 0x00, 0x00 }, // 21 !
{ 0x00, 0x07, 0x00, 0x07, 0x00 }, // 22 "
{ 0x14, 0x7f, 0x14, 0x7f, 0x14 }, // 23 #
@@ -138,22 +96,43 @@ const PROGMEM unsigned char font5x8[][5] = {
{ 0x10, 0x08, 0x08, 0x10, 0x08 }, // 7e ~
};
-// SevenSegNumFont.c
-// Font Size : 32x50
-// Memory usage : 2004 bytes
-// # characters : 10
+const unsigned char digits16x24[][48] PROGMEM = {
+{0x00,0x00,0x00,0xF0,0xFF,0x0F,0xFC,0xFF,0x3F,0xFE,0xFF,0x7F,0xFE,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0x7F,0xFE,0xFF,0x7F,0xFC,0xFF,0x3F,0xF0,0xFF,0x0F},/*"0",0*/
+{0x00,0x00,0x00,0x70,0x00,0x00,0x70,0x00,0x00,0x70,0x00,0x00,0x78,0x00,0x00,0xF8,0x00,0x00,0xFC,0xFF,0xFF,0xFE,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"1",0*/
+{0x00,0x00,0x00,0xF8,0x00,0xE0,0xFC,0x00,0xF8,0xFE,0x00,0xFE,0xFE,0x80,0xFF,0xFF,0xC0,0xFF,0x07,0xF0,0xFF,0x07,0xFC,0xFF,0x07,0xFF,0xEF,0xFF,0xFF,0xE3,0xFF,0xFF,0xE1,0xFE,0x7F,0xE0,0xFE,0x3F,0xE0,0xFC,0x0F,0xE0,0xF0,0x03,0x00,0x00,0x00,0x00},/*"2",2*/
+{0x00,0x00,0x00,0xF8,0x80,0x1F,0xFE,0x80,0x3F,0xFE,0x80,0x7F,0xFF,0x80,0x7F,0xFF,0x80,0xFF,0xFF,0x9C,0xFF,0xFF,0x9C,0xFF,0x07,0x1C,0xE0,0x07,0x3E,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0x7F,0xFE,0xF7,0x7F,0xFC,0xF7,0x3F,0xF0,0xE3,0x1F},/*"3",3*/
+{0x00,0xF0,0x0F,0x00,0xFE,0x0F,0x80,0xFF,0x0F,0xE0,0xFF,0x0F,0xFC,0xBF,0x0F,0xFF,0x87,0x0F,0xFF,0x81,0x0F,0x3F,0x80,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x80,0x0F,0x00,0x80,0x0F},/*"4",4*/
+{0x00,0x00,0x00,0xFF,0xC7,0x0F,0xFF,0xC7,0x3F,0xFF,0xC7,0x7F,0xFF,0xC7,0x7F,0xFF,0xC7,0xFF,0xFF,0xC7,0xFF,0x87,0x01,0xE0,0xC7,0x01,0xE0,0xC7,0x01,0xE0,0xC7,0xFF,0xFF,0xC7,0xFF,0xFF,0xC7,0xFF,0x7F,0x87,0xFF,0x7F,0x87,0xFF,0x3F,0x07,0xFE,0x1F},/*"5",5*/
+{0x00,0x00,0x00,0xF0,0xFF,0x0F,0xFC,0xFF,0x3F,0xFE,0xFF,0x7F,0xFE,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x06,0xE0,0x07,0x07,0xE0,0x07,0x07,0xE0,0x3F,0xFF,0xFF,0x3F,0xFF,0xFF,0x3E,0xFF,0x7F,0x3E,0xFE,0x7F,0x3C,0xFE,0x3F,0x38,0xF8,0x1F},/*"6",6*/
+{0x00,0x00,0x00,0x07,0x00,0x00,0x07,0x00,0x00,0x07,0x00,0xC0,0x07,0x00,0xF8,0x07,0x00,0xFF,0x07,0xE0,0xFF,0x07,0xFE,0xFF,0xC7,0xFF,0xFF,0xFF,0xFF,0x3F,0xFF,0xFF,0x07,0xFF,0xFF,0x00,0xFF,0x0F,0x00,0xFF,0x01,0x00,0x1F,0x00,0x00,0x00,0x00,0x00},/*"7",1*/
+{0x00,0x00,0x00,0xF0,0xE3,0x1F,0xFC,0xF7,0x3F,0xFE,0xFF,0x7F,0xFE,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x1C,0xE0,0x07,0x1C,0xE0,0x07,0x1C,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0x7F,0xFE,0xF7,0x7F,0xFC,0xF7,0x3F,0xF0,0xE3,0x1F},/*"8",8*/
+{0x00,0x00,0x00,0xF8,0x1F,0x1C,0xFC,0x7F,0x3C,0xFE,0x7F,0x7C,0xFE,0xFF,0x7C,0xFF,0xFF,0xFC,0xFF,0xFF,0xFC,0x07,0xE0,0xE0,0x07,0xE0,0xE0,0x07,0x60,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0x7F,0xFE,0xFF,0x7F,0xFC,0xFF,0x3F,0xF0,0xFF,0x0F},/*"9",9*/
+};
-const PROGMEM unsigned char sevenSegNumFont[]={
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x0C,0xFF,0xFE,0xF0,0x1E,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3E,0x00,0x00,0x78,0x38,0x00,0x00,0x18,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x38,0x00,0x00,0x18,0x3E,0x00,0x00,0x78,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x1E,0x00,0x00,0xF0,0x0C,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0xF0,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 1
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x00,0xFF,0xFE,0xF0,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x78,0x01,0xFF,0xFE,0x18,0x03,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x27,0xFF,0xFF,0xC0,0x39,0xFF,0xFF,0x00,0x3E,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x0C,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 2
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x00,0xFF,0xFE,0xF0,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x78,0x01,0xFF,0xFE,0x18,0x03,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x01,0xFF,0xFF,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 3
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x0C,0x00,0x00,0xF0,0x1E,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3E,0x00,0x00,0x78,0x39,0xFF,0xFE,0x18,0x23,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x01,0xFF,0xFF,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 4
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x0C,0xFF,0xFE,0x00,0x1E,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,0x39,0xFF,0xFE,0x00,0x23,0xFF,0xFF,0x80,0x0F,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x01,0xFF,0xFF,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 5
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x0C,0xFF,0xFE,0x00,0x1E,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,0x39,0xFF,0xFE,0x00,0x23,0xFF,0xFF,0x80,0x0F,0xFF,0xFF,0xE0,0x27,0xFF,0xFF,0xC0,0x39,0xFF,0xFF,0x18,0x3E,0x00,0x00,0x78,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x1E,0x00,0x00,0xF0,0x0C,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 6
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x00,0xFF,0xFE,0xF0,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 7
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x0C,0xFF,0xFE,0xF0,0x1E,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3E,0x00,0x00,0x78,0x39,0xFF,0xFE,0x18,0x23,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x27,0xFF,0xFF,0xC0,0x39,0xFF,0xFF,0x18,0x3E,0x00,0x00,0x78,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x1E,0x00,0x00,0xF0,0x0C,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 8
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x0C,0xFF,0xFE,0xF0,0x1E,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3E,0x00,0x00,0x78,0x39,0xFF,0xFE,0x18,0x23,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x01,0xFF,0xFF,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 9
+const unsigned char digits16x16[][32] PROGMEM = {
+{0x00,0xE0,0xF8,0xFC,0xFE,0x1E,0x07,0x07,0x07,0x07,0x1E,0xFE,0xFC,0xF8,0xF0,0x00,0x00,0x07,0x0F,0x3F,0x3F,0x7C,0x70,0x70,0x70,0x70,0x7C,0x3F,0x1F,0x1F,0x07,0x00},/*0*/
+{0x00,0x00,0x00,0x06,0x07,0x07,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x7F,0x00,0x00,0x00,0x00,0x00,0x00},/*1*/
+{0x00,0x38,0x3C,0x3E,0x3E,0x0F,0x07,0x07,0x07,0xCF,0xFF,0xFE,0xFE,0x38,0x00,0x00,0x00,0x40,0x40,0x60,0x70,0x78,0x7C,0x7E,0x7F,0x77,0x73,0x71,0x70,0x70,0x00,0x00},/*2*/
+{0x00,0x18,0x1C,0x1E,0x1E,0x0F,0xC7,0xC7,0xE7,0xFF,0xFE,0xBE,0x9C,0x00,0x00,0x00,0x00,0x0C,0x1C,0x3C,0x3C,0x78,0x70,0x70,0x70,0x79,0x7F,0x3F,0x1F,0x0F,0x00,0x00},/*3*/
+{0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,0x1E,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x06,0x07,0x07,0x07,0x06,0x06,0x06,0x06,0x06,0x7F,0x7F,0x7F,0x7F,0x06,0x06,0x00},/*4*/
+{0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xE7,0xE7,0xE7,0xE7,0xC7,0x87,0x00,0x00,0x00,0x00,0x38,0x78,0x71,0x70,0x70,0x70,0x70,0x70,0x39,0x3F,0x3F,0x1F,0x0F,0x00},/*5*/
+{0x00,0x80,0xE0,0xF0,0xF8,0xFC,0x7F,0x7F,0x6F,0x67,0xE1,0xE1,0xC0,0x80,0x00,0x00,0x00,0x0F,0x1F,0x3F,0x3F,0x78,0x70,0x70,0x70,0x70,0x78,0x3F,0x3F,0x1F,0x0F,0x00},/*6*/
+{0x00,0x07,0x07,0x07,0x07,0x07,0xC7,0xE7,0xF7,0xFF,0x7F,0x3F,0x1F,0x07,0x03,0x01,0x00,0x20,0x38,0x7C,0x7E,0x3F,0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*7*/
+{0x00,0x00,0x00,0x1C,0xBE,0xFE,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFE,0xBE,0x1C,0x00,0x00,0x00,0x0E,0x3F,0x3F,0x7F,0x71,0x60,0x60,0x60,0x71,0x7F,0x3F,0x3F,0x0F,0x00},/*8*/
+{0x00,0x78,0xFC,0xFE,0xFE,0x8F,0x07,0x07,0x07,0x07,0x8F,0xFE,0xFE,0xFC,0xF8,0x00,0x00,0x00,0x00,0x01,0x43,0x43,0x73,0x7B,0x7F,0x7F,0x1F,0x0F,0x07,0x03,0x00,0x00},/*9*/
+};
+
+const unsigned char digits8x8[][8] PROGMEM = {
+{0x3C,0x7E,0x83,0x81,0x81,0x7E,0x3C,0x00},/*0*/
+{0x84,0x84,0x82,0xFF,0xFF,0x80,0x80,0x00},/*1*/
+{0x84,0xC6,0xE1,0xA1,0xB1,0x9F,0x8E,0x00},/*2*/
+{0x42,0xC3,0x81,0x89,0x89,0xFF,0x76,0x00},/*3*/
+{0x20,0x38,0x24,0x22,0xFF,0xFF,0x20,0x00},/*4*/
+{0x5F,0xDF,0x99,0x89,0x89,0xF9,0x70,0x00},/*5*/
+{0x3C,0x7E,0x89,0x89,0x89,0xFB,0x72,0x00},/*6*/
+{0x01,0x01,0xE1,0xF9,0x1D,0x07,0x01,0x00},/*7*/
+{0x6E,0xFF,0x89,0x89,0x99,0xFF,0x76,0x00},/*8*/
+{0x4E,0xDF,0x91,0x91,0x91,0x7F,0x3E,0x00},/*9*/
};
#ifndef MEMORY_SAVING
diff --git a/libraries/MultiLCD/memorysaver.h b/libraries/MultiLCD/memorysaver.h
new file mode 100644
index 0000000..34575eb
--- /dev/null
+++ b/libraries/MultiLCD/memorysaver.h
@@ -0,0 +1,45 @@
+// UTFT Memory Saver
+// -----------------
+//
+// Since most people have only one or possibly two different display modules a lot
+// of memory has been wasted to keep support for many unneeded controller chips.
+// You now have the option to remove this unneeded code from the library with
+// this file.
+// By disabling the controllers you don't need you can reduce the memory footprint
+// of the library by several Kb.
+//
+// Uncomment the lines for the displaycontrollers that you don't use to save
+// some flash memory by not including the init code for that particular
+// controller.
+
+#define DISABLE_CPLD 1 // EHOUSE50CPLD
+
+#define DISABLE_HX8340B_8 1 // ITDB22 8bit mode / GEEE22
+#define DISABLE_HX8340B_S 1 // ITDB22 Serial mode
+#define DISABLE_HX8347A 1 // ITDB32
+#define DISABLE_HX8352A 1 // ITDB32WD / TFT01_32WD / CTE32W
+#define DISABLE_HX8353C 1 // DMTFT18101
+
+#define DISABLE_ILI9320 1 // GEEE24 / GEEE28 - This single define will disable both 8bit and 16bit mode for this controller
+#define DISABLE_ILI9325C 1 // ITDB24
+#define DISABLE_ILI9325D 1 // ITDB24D / ITDB24DWOT / ITDB28 / TFT01_24_8 / TFT01_24_16 / DMTFT24104 / DMTFT28103 - This single define will disable both 8bit and 16bit mode for this controller
+#define DISABLE_ILI9325D_ALT 1 // CTE28
+#define DISABLE_ILI9327 1 // ITDB32WC / TFT01_32W
+#define DISABLE_ILI9341_S4P 1 // MI0283QT9
+#define DISABLE_ILI9341_S5P 1 // TFT01_22SP / DMTFT28105
+#define DISABLE_ILI9481 1 // CTE32HR
+#define DISABLE_ILI9486 1 // CTE40
+
+#define DISABLE_PCF8833 1 // LPH9135
+
+#define DISABLE_R61581 1 // CTE35IPS
+
+#define DISABLE_S1D19122 1 // ITDB25H
+#define DISABLE_S6D0164 1 // CTE22 / DMTFT22102
+#define DISABLE_S6D1121 1 // ITDB24E - This single define will disable both 8bit and 16bit mode for this controller
+#define DISABLE_SSD1289 1 // ITDB32S / TFT01_32 / GEEE32 / ELEE32_REVA / ELEE32_REVB / CTE32 - This single define will disable both 8bit, 16bit and latched mode for this controller
+#define DISABLE_SSD1963_480 1 // ITDB43 / TFT01_43
+#define DISABLE_SSD1963_800 1 // ITDB50 / TFT01_50 / CTE50 / EHOUSE50
+#define DISABLE_SSD1963_800_ALT 1 // TFT01_70 / CTE70 / EHOUSE70
+#define DISABLE_ST7735 1 // ITDB18SP
+#define DISABLE_ST7735S 1 // TFT01_18SP