A fork of Chris Yan's Nokia 5110 LCD library, adapted to LPC1347. Should work on a DipCortex M3 and an EzSBC2 dev board.

Dependencies:   mbed

Fork of Nokia5110 by Krissi Yan

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // Project: Nokia5110 - Controlling a NK5110 display from an NXP LPC1768
00002 // File: main.cpp
00003 // Author: Chris Yan
00004 // Created: January, 2012
00005 // Revised: 
00006 //  Desc: A basic LCD output test which uses the NXP LPC1768's SPI interface to 
00007 //      display pixels, characters, and numbers on the Nokia 5110 LCD.
00008 //      Created using a sparkfun breakout board with integrated Phillips 8544 driver
00009 //      for 48x84 LCDs.
00010 // 
00011 // Version for EzSBC2 (an LPC1347 dev board similar to DipCortex M3) by Jonne Valola
00012 
00013 #include "mbed.h"
00014 #include "NOKIA_5110.h"
00015 
00016 int main()
00017 {
00018     // Init the data structures and NokiaLcd class
00019     LcdPins myPins;
00020     /*myPins.sce  = p8;
00021     myPins.rst  = p9;
00022     myPins.dc   = p10;
00023     myPins.mosi = p11;
00024     myPins.miso = NC;
00025     myPins.sclk = p13;*/
00026     myPins.sce  = P0_2; // SPI0 SSEL
00027     myPins.rst  = P0_4; // can be anything
00028     myPins.dc   = P0_5;
00029     myPins.mosi = P0_9;
00030     myPins.miso = P0_8;
00031     myPins.sclk = P1_29;
00032     
00033     NokiaLcd myLcd( myPins );
00034     
00035     // Start the LCD
00036     myLcd.InitLcd();
00037 
00038     // Draw a test pattern on the LCD and stall for 15 seconds
00039     myLcd.TestLcd( 0xAA );
00040     wait( 15 );
00041     
00042     // Turn off the LCD and enter an endless loop
00043     myLcd.ShutdownLcd();
00044     while( 1 )
00045     {   
00046         //dance
00047     }
00048 }