A fork of Chris Yan's Nokia 5110 LCD library, adapted to LPC1347. Should work on a DipCortex M3 and an EzSBC2 dev board.
Fork of Nokia5110 by
main.cpp@4:46e538ce39d4, 2015-07-02 (annotated)
- Committer:
- smultron1977
- Date:
- Thu Jul 02 23:52:55 2015 +0000
- Revision:
- 4:46e538ce39d4
- Parent:
- 2:e448efb1fa68
A fork of Nokia 5110 lib by Chris Yan adapted for LPC1347 (and EzSBC2 dev board)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Fuzball | 2:e448efb1fa68 | 1 | // Project: Nokia5110 - Controlling a NK5110 display from an NXP LPC1768 |
Fuzball | 2:e448efb1fa68 | 2 | // File: main.cpp |
Fuzball | 2:e448efb1fa68 | 3 | // Author: Chris Yan |
Fuzball | 2:e448efb1fa68 | 4 | // Created: January, 2012 |
Fuzball | 2:e448efb1fa68 | 5 | // Revised: |
Fuzball | 2:e448efb1fa68 | 6 | // Desc: A basic LCD output test which uses the NXP LPC1768's SPI interface to |
Fuzball | 2:e448efb1fa68 | 7 | // display pixels, characters, and numbers on the Nokia 5110 LCD. |
Fuzball | 2:e448efb1fa68 | 8 | // Created using a sparkfun breakout board with integrated Phillips 8544 driver |
Fuzball | 2:e448efb1fa68 | 9 | // for 48x84 LCDs. |
smultron1977 | 4:46e538ce39d4 | 10 | // |
smultron1977 | 4:46e538ce39d4 | 11 | // Version for EzSBC2 (an LPC1347 dev board similar to DipCortex M3) by Jonne Valola |
Fuzball | 2:e448efb1fa68 | 12 | |
Fuzball | 2:e448efb1fa68 | 13 | #include "mbed.h" |
Fuzball | 2:e448efb1fa68 | 14 | #include "NOKIA_5110.h" |
Fuzball | 2:e448efb1fa68 | 15 | |
Fuzball | 2:e448efb1fa68 | 16 | int main() |
Fuzball | 2:e448efb1fa68 | 17 | { |
Fuzball | 2:e448efb1fa68 | 18 | // Init the data structures and NokiaLcd class |
Fuzball | 2:e448efb1fa68 | 19 | LcdPins myPins; |
smultron1977 | 4:46e538ce39d4 | 20 | /*myPins.sce = p8; |
Fuzball | 2:e448efb1fa68 | 21 | myPins.rst = p9; |
Fuzball | 2:e448efb1fa68 | 22 | myPins.dc = p10; |
Fuzball | 2:e448efb1fa68 | 23 | myPins.mosi = p11; |
Fuzball | 2:e448efb1fa68 | 24 | myPins.miso = NC; |
smultron1977 | 4:46e538ce39d4 | 25 | myPins.sclk = p13;*/ |
smultron1977 | 4:46e538ce39d4 | 26 | myPins.sce = P0_2; // SPI0 SSEL |
smultron1977 | 4:46e538ce39d4 | 27 | myPins.rst = P0_4; // can be anything |
smultron1977 | 4:46e538ce39d4 | 28 | myPins.dc = P0_5; |
smultron1977 | 4:46e538ce39d4 | 29 | myPins.mosi = P0_9; |
smultron1977 | 4:46e538ce39d4 | 30 | myPins.miso = P0_8; |
smultron1977 | 4:46e538ce39d4 | 31 | myPins.sclk = P1_29; |
Fuzball | 2:e448efb1fa68 | 32 | |
Fuzball | 2:e448efb1fa68 | 33 | NokiaLcd myLcd( myPins ); |
Fuzball | 2:e448efb1fa68 | 34 | |
Fuzball | 2:e448efb1fa68 | 35 | // Start the LCD |
Fuzball | 2:e448efb1fa68 | 36 | myLcd.InitLcd(); |
Fuzball | 2:e448efb1fa68 | 37 | |
Fuzball | 2:e448efb1fa68 | 38 | // Draw a test pattern on the LCD and stall for 15 seconds |
Fuzball | 2:e448efb1fa68 | 39 | myLcd.TestLcd( 0xAA ); |
Fuzball | 2:e448efb1fa68 | 40 | wait( 15 ); |
Fuzball | 2:e448efb1fa68 | 41 | |
Fuzball | 2:e448efb1fa68 | 42 | // Turn off the LCD and enter an endless loop |
Fuzball | 2:e448efb1fa68 | 43 | myLcd.ShutdownLcd(); |
Fuzball | 2:e448efb1fa68 | 44 | while( 1 ) |
Fuzball | 2:e448efb1fa68 | 45 | { |
Fuzball | 2:e448efb1fa68 | 46 | //dance |
Fuzball | 2:e448efb1fa68 | 47 | } |
Fuzball |
1:e25ab356dc9b | 48 | } |