PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)

Files at this revision

API Documentation at this revision

Comitter:
spinal
Date:
Sun Nov 18 15:47:54 2018 +0000
Parent:
63:7d1c08cdde5c
Commit message:
added fix for directrectangle()

Changed in this revision

POKITTO_HW/HWLCD.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/POKITTO_HW/HWLCD.cpp	Tue Oct 23 16:21:01 2018 +0000
+++ b/POKITTO_HW/HWLCD.cpp	Sun Nov 18 15:47:54 2018 +0000
@@ -410,7 +410,6 @@
 	setWindow(0, 0, 175, 219);
 }
 
-
 void Pokitto::lcdRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) {
 	int16_t temp;
 	if (x0>x1) {temp=x0;x0=x1;x1=temp;}
@@ -421,24 +420,35 @@
 	if (y1 > POK_LCD_H) y1=POK_LCD_H;
 	if (x0 < 0) x0=0;
 	if (y0 < 0) y0=0;
-
+	
 	int16_t x,y;
-	for (x=x0; x<=x1;x++) {
-		write_command(0x20);  // Horizontal DRAM Address (=y on pokitto screen)
-		write_data(y0);
-		write_command(0x21);  // Vertical DRAM Address (=x on pokitto screen)
-		write_data(x);
+	
+	for (y=y0; y<y1;y++) {
+	
+		write_command(0x20); // Horizontal DRAM Address (=y on pokitto screen)
+		
+		write_data(y);
+		
+		write_command(0x21); // Vertical DRAM Address (=x on pokitto screen)
+		
+		write_data(x0);
+		
 		write_command(0x22); // write data to DRAM
+		
+		CLR_CS_SET_CD_RD_WR; // go to vram write mode
+		
+		for (x=x0; x<x1;x++) {
+		
+			setup_data_16(color); // setup the data (flat color = no change between pixels)
+			
+			CLR_WR;SET_WR; //CLR_WR;SET_WR;//toggle writeline, pokitto screen writes a column up to down
+		
+		}
+	
+	}
 
-		CLR_CS_SET_CD_RD_WR; // go to vram write mode
-
+}
 
-		for (y=y0; y<y1;y++) {
-				setup_data_16(color); // setup the data (flat color = no change between pixels)
-				CLR_WR;SET_WR; //CLR_WR;SET_WR;//toggle writeline, pokitto screen writes a column up to down
-		}
-	}
-}
 
 /***
  * Update the screen buffer of 220x176 pixels, 4 colors to LCD.