An interface for controlling a 130x130 Nokia mobile phone display.

There are a number of different hardware breakouts available for these panels. See:
The LCD panels themselves also vary, particularly whether they use an Epson or Philips driver. This library aims to support both types. Fiddle with the type parameter if yours doesn't seem to work.
00001 // Hello World! for Nokia LCD, sford 00002 // - LCD6610 is for newest Sparkfun breakout 00003 00004 #include "mbed.h" 00005 #include "NokiaLCD.h" 00006 00007 NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::LCD6610); // mosi, sclk, cs, rst, type 00008 00009 int main() { 00010 lcd.background(0x0000FF); 00011 lcd.cls(); 00012 lcd.fill(2, 51, 128, 10, 0x00FF00); 00013 lcd.fill(50, 1, 10, 128, 0xFF0000); 00014 lcd.locate(0,3); 00015 lcd.printf("Hello World!"); 00016 for (int i=0; i<130; i++) { 00017 lcd.pixel(i, 80 + sin((float)i / 5.0)*10, 0x000000); 00018 } 00019 }

On other displays, you may also have to wire e.g. VBATT (the screen backlight) to 3.3v
Public Types |
|
| enum | LCDType { LCD6100 , LCD6610 } |
|
LCD panel format. More... |
|
Public Member Functions |
|
| NokiaLCD (PinName mosi, PinName sclk, PinName cs, PinName rst, LCDType type=LCD6100) | |
|
Create and Nokia LCD interface, using a SPI and two DigitalOut interfaces.
|
|
| int | putc (int c) |
|
Write a character to the LCD.
|
|
| int | printf (const char *format,...) |
|
Write a formated string to the LCD.
|
|
| void | locate (int column, int row) |
|
Locate to a screen column and row.
|
|
| void | cls () |
|
Clear the screen and locate to 0,0.
|
|
| void | pixel (int x, int y, int colour) |
|
Set a pixel on te screen.
|
|
| void | fill (int x, int y, int width, int height, int colour) |
|
Fill an area of the screen.
|
|
| void | foreground (int c) |
|
Set the foreground colour.
|
|
| void | background (int c) |
|
Set the background colour.
|
|
Please login to post comments.
I have the new Sparkfun Nokia LCD breakout board with the 6610 instead of the 6100. I noticed a few things when I tested out the Hello World code.
1) The two leftmost columns of pixels appeared whitish and were not affected by the lcd.background() command. I modified NokiaLCD.cpp line 118 from x1=x+2 to x1=x+0 and the whitish pixels went away.
2) The sine wave seems to create some problem for the lcd.fill() command. If I display a green rectangle before the sine wave is drawn then it displays OK. But if I display a green rectangle after the sine wave is drawn then it is displayed as a red & blue striped rectangle.
3) The display appears to be 130x132 instead of 130x130. The reason I think this is because I drew a box pattern using the following code and noticed there are two rows of pixels visible below the bottom green border.
Code
lcd.fill(0, 0, 130, 1, 0x00FF00); lcd.fill(129, 0, 1, 130, 0x00FF00); lcd.fill(0, 0, 1, 130, 0x00FF00); lcd.fill(0, 129, 130, 1, 0x00FF00);These two rows appear to be a slightly darker blue than the 0x0000FF background. I tried changing the NOKIALCD_HEIGHT parameter but I was still not able to access those rows.