spinal cord / PokittoLib

Dependents:   Sensitive

Fork of PokittoLib by Jonne Valola

Revision:
5:9b96eaceeb30
Parent:
2:968589ca3484
--- a/POKITTO_HW/HWLCD.cpp	Tue Sep 19 13:42:25 2017 +0000
+++ b/POKITTO_HW/HWLCD.cpp	Thu Oct 12 16:24:33 2017 +0000
@@ -327,17 +327,62 @@
     }
 }
 
+
+
+
+
+
+
+
+
+void Pokitto::setWindow(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2) {
+	write_command(0x37); write_data(x1);
+	write_command(0x36); write_data(x2);
+	write_command(0x39); write_data(y1);
+	write_command(0x38); write_data(y2);
+	write_command(0x20); write_data(x1);
+	write_command(0x21); write_data(y1);
+}
+
+void Pokitto::lcdTile(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t* gfx){
+
+	int width=x1-x0;
+	int height=y1-y0;
+
+	if (x0 > POK_LCD_W) return;
+	if (y0 > POK_LCD_H) return;
+	if (x0 < 0) x0=0;
+	if (y0 < 0) y0=0;
+
+	setWindow(y0, x0, y1-1, x1-1);
+
+    write_command(0x22);
+
+    for (int x=0; x<=width*height-1;x++) {
+        write_data(gfx[x]);
+    }
+	setWindow(0, 0, 175, 219);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
 void Pokitto::lcdPixel(int16_t x, int16_t y, uint16_t color) {
     if ((x < 0) || (x >= POK_LCD_W) || (y < 0) || (y >= POK_LCD_H))
 	return;
-	write_command(0x20);  // Horizontal DRAM Address
-    write_data(y);  // 0
-    write_command(0x21);  // Vertical DRAM Address
-    write_data(x);
-    write_command(0x22); // write data to DRAM
-    CLR_CS_SET_CD_RD_WR;
-    setup_data_16(color);
-    CLR_WR;SET_WR;
+	write_command(0x20); write_data(y);
+	write_command(0x21); write_data(x);
+    write_command(0x22); write_data(color);
+    
 }
 
 void Pokitto::lcdRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) {