Craig Evans / N5110

Dependents:   LV7_LCDtest LV7_Grupa5_Tim003_Zadatak1 lv7_Grupa5_Tim008_zad1 LV7_PAI_Grupa5_tim10_Zadatak1 ... more

Files at this revision

API Documentation at this revision

Comitter:
eencae
Date:
Mon May 19 18:23:21 2014 +0000
Parent:
6:adb79338d40f
Child:
8:40abe5736eca
Commit message:
Modified refresh() function so that the address is reset to (0,0) before sending the entire screen buffer to the display. Ensures the origin of the buffer coincides with the top-left pixel. This may not be the case after printing strings.

Changed in this revision

N5110.cpp Show annotated file Show diff for this revision Revisions of this file
N5110.h Show annotated file Show diff for this revision Revisions of this file
--- a/N5110.cpp	Mon Jan 27 18:41:45 2014 +0000
+++ b/N5110.cpp	Mon May 19 18:23:21 2014 +0000
@@ -176,10 +176,10 @@
     buffer[x][y/8] &= ~(1 << y%8);
 }
 
-unsigned char N5110::getPixel(int x, int y)
+int N5110::getPixel(int x, int y)
 {
     // return relevant bank and mask required bit
-    return buffer[x][y/8] & (1 << y%8);
+    return (int) buffer[x][y/8] & (1 << y%8);
 
 }
 
@@ -187,6 +187,11 @@
 void N5110::refresh()
 {
     int i,j;
+    
+    setXYAddress(0,0);  // important to set address back to 0,0 before refreshing display
+    // address auto increments after printing string, so buffer[0][0] will not coincide
+    // with top-left pixel after priting string
+    
     sce->write(0);  //set CE low to begin frame
 
     for(j = 0; j < 6; j++) {  // be careful to use correct order (j,i) for horizontal addressing
@@ -233,7 +238,7 @@
     while(*str) {
 
         setXYAddress(x+6*n,y);  // leave 1 pixel (6 = 5 + 1) between each character
-        printChar(*str);   // print the char - can probably so *str++ and remove next line
+        printChar(*str);   // print the char - can probably do *str++ and remove next line
         str++;  // go to next character in string
         n++;    // increment index
     }
--- a/N5110.h	Mon Jan 27 18:41:45 2014 +0000
+++ b/N5110.h	Mon May 19 18:23:21 2014 +0000
@@ -177,7 +177,7 @@
     *       0           - pixel is clear
     *       non-zero    - pixel is set
     */
-    unsigned char getPixel(int x, int y);
+    int getPixel(int x, int y);
     
     /** Refresh display
     *