summaryrefslogtreecommitdiff
path: root/libraries/MultiLCD/SSD1289.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/MultiLCD/SSD1289.cpp')
-rw-r--r--libraries/MultiLCD/SSD1289.cpp62
1 files changed, 14 insertions, 48 deletions
diff --git a/libraries/MultiLCD/SSD1289.cpp b/libraries/MultiLCD/SSD1289.cpp
index 5c5a073..2fc8d8e 100644
--- a/libraries/MultiLCD/SSD1289.cpp
+++ b/libraries/MultiLCD/SSD1289.cpp
@@ -12,49 +12,15 @@
Define zone
**********************************************/
-#define RS 59
-#define WR 58
-#define CS 57
-#define RST 56
-
#define PIN_BACKLIGHT 8
-#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);
+ _hw_special_init();
+
pinMode(__p1,OUTPUT);
pinMode(__p2,OUTPUT);
pinMode(__p3,OUTPUT);
@@ -65,10 +31,8 @@ void LCD_SSD1289::begin()
if (display_transfer_mode!=1)
_set_direction_registers(display_transfer_mode);
- _hw_special_init();
-
sbi(P_RST, B_RST);
- delay(5);
+ delay(5);
cbi(P_RST, B_RST);
delay(15);
sbi(P_RST, B_RST);
@@ -121,9 +85,9 @@ void LCD_SSD1289::begin()
LCD_Write_COM_DATA(0x25,0x8000);
LCD_Write_COM_DATA(0x4f,0x0000);
LCD_Write_COM_DATA(0x4e,0x0000);
- LCD_Write_COM(0x22);
+ LCD_Write_COM(0x22);
- sbi (P_CS, B_CS);
+ sbi (P_CS, B_CS);
clear();
@@ -144,7 +108,7 @@ void LCD_SSD1289::setXY(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
LCD_Write_COM_DATA(0x46,y2);
LCD_Write_COM_DATA(0x4e,x1);
LCD_Write_COM_DATA(0x4f,y1);
- LCD_Write_COM(0x22);
+ LCD_Write_COM(0x22);
}
void LCD_SSD1289::setBackLight(byte brightness)
@@ -161,18 +125,20 @@ void LCD_SSD1289::Disable()
sbi(P_CS, B_CS);
}
-void LCD_SSD1289::clearPixels(uint16_t pixels)
+void LCD_SSD1289::clearPixels(uint32_t pixels)
{
+ Enable();
do {
setPixel(bch, bcl);
} while(--pixels);
+ Disable();
}
-void LCD_SSD1289::clear()
+void LCD_SSD1289::clear(uint16_t x, uint16_t y, uint16_t width, uint16_t height)
{
- setColor(0);
- fillRect(0, 0, 319, 239);
- setColor(0xffff);
+ setColor(0);
+ fillRect(x, y, x + width, y + height);
+ setColor(0xffff);
m_x = 0;
m_y = 0;
}
@@ -186,7 +152,7 @@ size_t LCD_SSD1289::write(uint8_t c)
m_x = 0;
return 0;
}
- if (m_x >= 320) return 0;
+ if (m_x > disp_y_size) return 0;
Enable();
if (m_font == FONT_SIZE_SMALL) {
setXY(m_x, m_y, m_x + 4, m_y + 7);