Clock to use with LCD NK5110. You need to use N5110 libraries
Fork of Nokia5110 by
main.cpp@2:e448efb1fa68, 2014-01-10 (annotated)
- Committer:
- Fuzball
- Date:
- Fri Jan 10 19:57:40 2014 +0000
- Revision:
- 2:e448efb1fa68
- Parent:
- 1:e25ab356dc9b
- Child:
- 4:9382162fdb60
Cleaned up some non-code stuff and updated to use the newer mbed libs
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. |
Fuzball | 2:e448efb1fa68 | 10 | |
Fuzball | 2:e448efb1fa68 | 11 | #include "mbed.h" |
Fuzball | 2:e448efb1fa68 | 12 | #include "NOKIA_5110.h" |
Fuzball | 2:e448efb1fa68 | 13 | |
Fuzball | 2:e448efb1fa68 | 14 | int main() |
Fuzball | 2:e448efb1fa68 | 15 | { |
Fuzball | 2:e448efb1fa68 | 16 | // Init the data structures and NokiaLcd class |
Fuzball | 2:e448efb1fa68 | 17 | LcdPins myPins; |
Fuzball | 2:e448efb1fa68 | 18 | myPins.sce = p8; |
Fuzball | 2:e448efb1fa68 | 19 | myPins.rst = p9; |
Fuzball | 2:e448efb1fa68 | 20 | myPins.dc = p10; |
Fuzball | 2:e448efb1fa68 | 21 | myPins.mosi = p11; |
Fuzball | 2:e448efb1fa68 | 22 | myPins.miso = NC; |
Fuzball | 2:e448efb1fa68 | 23 | myPins.sclk = p13; |
Fuzball | 2:e448efb1fa68 | 24 | |
Fuzball | 2:e448efb1fa68 | 25 | NokiaLcd myLcd( myPins ); |
Fuzball | 2:e448efb1fa68 | 26 | |
Fuzball | 2:e448efb1fa68 | 27 | // Start the LCD |
Fuzball | 2:e448efb1fa68 | 28 | myLcd.InitLcd(); |
Fuzball | 2:e448efb1fa68 | 29 | |
Fuzball | 2:e448efb1fa68 | 30 | // Draw a test pattern on the LCD and stall for 15 seconds |
Fuzball | 2:e448efb1fa68 | 31 | myLcd.TestLcd( 0xAA ); |
Fuzball | 2:e448efb1fa68 | 32 | wait( 15 ); |
Fuzball | 2:e448efb1fa68 | 33 | |
Fuzball | 2:e448efb1fa68 | 34 | // Turn off the LCD and enter an endless loop |
Fuzball | 2:e448efb1fa68 | 35 | myLcd.ShutdownLcd(); |
Fuzball | 2:e448efb1fa68 | 36 | while( 1 ) |
Fuzball | 2:e448efb1fa68 | 37 | { |
Fuzball | 2:e448efb1fa68 | 38 | //dance |
Fuzball | 2:e448efb1fa68 | 39 | } |
Fuzball |
1:e25ab356dc9b | 40 | } |