Library for interfacing to Nokia 5110 LCD display (as found on the SparkFun website).

Dependents:   LV7_LCDtest LV7_Grupa5_Tim003_Zadatak1 lv7_Grupa5_Tim008_zad1 LV7_PAI_Grupa5_tim10_Zadatak1 ... more

This library is designed to make it easy to interface an mbed with a Nokia 5110 LCD display.

These can be found at Sparkfun (https://www.sparkfun.com/products/10168) and Adafruit (http://www.adafruit.com/product/338).

The library uses the SPI peripheral on the mbed which means it is much faster sending data to the display than other libraries available on other platforms that use software SPI.

The library can print strings as well as controlling individual pixels, meaning that both text and primitive graphics can be displayed.

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
     }