Simple library for interfacing to Nokia 5110 LCD display (as found on the SparkFun website). Edited to include additional feaatures, such as 2d array loading, multiple screen buffers, and better backlight control

Dependencies:   N5110

Dependents:   Main_code_ver18

Fork of N5110 by Craig Evans

Revision:
7:3010f24e0a81
Parent:
6:adb79338d40f
Child:
8:40abe5736eca
--- 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
     }