no

Dependencies:   DS1820 TextLCD mbed

Fork of TextLCD_HelloWorld2 by Wim Huiskamp

Committer:
wupinxian
Date:
Sun Mar 19 16:03:12 2017 +0000
Revision:
5:7ed4428bc142
no

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wupinxian 5:7ed4428bc142 1 // Project: Nokia5110 - Controlling a NK5110 display from an NXP LPC1768
wupinxian 5:7ed4428bc142 2 // File: NOKIA_5110.h
wupinxian 5:7ed4428bc142 3 // Author: Chris Yan
wupinxian 5:7ed4428bc142 4 // Created: January, 2012
wupinxian 5:7ed4428bc142 5 // Revised: January, 2014
wupinxian 5:7ed4428bc142 6 // Desc: Commands, fonts, and class for using a
wupinxian 5:7ed4428bc142 7 // Nokia 5110 LCD via the Phillips 8554 LCD driver.
wupinxian 5:7ed4428bc142 8 //
wupinxian 5:7ed4428bc142 9 // Typical Usage: User must fill the LcdPins struct with the pinout used to control the LCD and
wupinxian 5:7ed4428bc142 10 // instantiate the NokiaLcd class - passing the created LcdPins struct to the constructor.
wupinxian 5:7ed4428bc142 11 // The class function NokiaLcd::InitLcd may then be called to reset and start the LCD driver.
wupinxian 5:7ed4428bc142 12 // A simple 6x6 font (6x8 in LCD space and ~5x5 character space) is included to facilitate
wupinxian 5:7ed4428bc142 13 // the NokiaLcd::DrawChar( char character ) function, which will copy the character 8 bits
wupinxian 5:7ed4428bc142 14 // at a time for 6 clock cycles.
wupinxian 5:7ed4428bc142 15 // Commands may be sent to the LCD via the NokiaLcd::SendFunction(char cmd)
wupinxian 5:7ed4428bc142 16 // function, but be aware that certain commands require the Function Set register's H-value
wupinxian 5:7ed4428bc142 17 // to be either 1 or 0, depending on the command. This class does not check to see whether
wupinxian 5:7ed4428bc142 18 // the H-value is of proper status. The Function Set register /may/ be changed via the
wupinxian 5:7ed4428bc142 19 // NokiaLcd::SendFunction(char cmd), but the code uses this internally and expects that
wupinxian 5:7ed4428bc142 20 // most function registers have not been changed by the user.
wupinxian 5:7ed4428bc142 21 //
wupinxian 5:7ed4428bc142 22 // Example:
wupinxian 5:7ed4428bc142 23 // #include "mbed.h"
wupinxian 5:7ed4428bc142 24 // #include "NOKIA_5110.h"
wupinxian 5:7ed4428bc142 25 //
wupinxian 5:7ed4428bc142 26 // int main() {
wupinxian 5:7ed4428bc142 27 // LcdPins myLcdPins = { p11, NC, p13, p10, p8, p9 };
wupinxian 5:7ed4428bc142 28 // NokiaLcd myLcd( myLcdPins ); // SPI is started here (8-bits, mode 1)
wupinxian 5:7ed4428bc142 29 // myLcd.InitLcd(); // LCD is reset and DDRAM is cleared
wupinxian 5:7ed4428bc142 30 // myLcd.TestLcd( 0xAA ); // Draws a vertical pattern where every other pixel is on
wupinxian 5:7ed4428bc142 31 // wait(10);
wupinxian 5:7ed4428bc142 32 // myLcd.ShutdownLcd(); // Clears the LCD's DDRAM and powers it down via CMD_FS_POWER_DOWN_MODE, H=0
wupinxian 5:7ed4428bc142 33 // while(1)
wupinxian 5:7ed4428bc142 34 // { };
wupinxian 5:7ed4428bc142 35 // }
wupinxian 5:7ed4428bc142 36
wupinxian 5:7ed4428bc142 37 // Command Instructions
wupinxian 5:7ed4428bc142 38 // H = 0
wupinxian 5:7ed4428bc142 39 #ifndef __NOKIA_5110_H__
wupinxian 5:7ed4428bc142 40 #define __NOKIA_5110_H__
wupinxian 5:7ed4428bc142 41
wupinxian 5:7ed4428bc142 42 // Command Instructions
wupinxian 5:7ed4428bc142 43 // H = 0
wupinxian 5:7ed4428bc142 44 #define CMD_DC_CLEAR_DISPLAY 0x08
wupinxian 5:7ed4428bc142 45 #define CMD_DC_NORMAL_MODE 0x0C
wupinxian 5:7ed4428bc142 46 #define CMD_DC_FILL_DISPLAY 0x09
wupinxian 5:7ed4428bc142 47 #define CMD_DC_INVERT_VIDEO 0x0D
wupinxian 5:7ed4428bc142 48 #define CMD_FS_HORIZONTAL_MODE 0x00
wupinxian 5:7ed4428bc142 49 #define CMD_FS_VERTICAL_MODE 0x02
wupinxian 5:7ed4428bc142 50 #define CMD_FS_BASIC_MODE 0x00
wupinxian 5:7ed4428bc142 51 #define CMD_FS_EXTENDED_MODE 0x01
wupinxian 5:7ed4428bc142 52 #define CMD_FS_ACTIVE_MODE 0x00
wupinxian 5:7ed4428bc142 53 #define CMD_FS_POWER_DOWN_MODE 0x04
wupinxian 5:7ed4428bc142 54 // H = 1
wupinxian 5:7ed4428bc142 55 #define CMD_TC_TEMP_0 0x04
wupinxian 5:7ed4428bc142 56 #define CMD_TC_TEMP_1 0x05
wupinxian 5:7ed4428bc142 57 #define CMD_TC_TEMP_2 0x06
wupinxian 5:7ed4428bc142 58 #define CMD_TC_TEMP_3 0x07
wupinxian 5:7ed4428bc142 59 #define CMD_BI_MUX_24 0x15
wupinxian 5:7ed4428bc142 60 #define CMD_BI_MUX_48 0x13
wupinxian 5:7ed4428bc142 61 #define CMD_BI_MUX_100 0x10
wupinxian 5:7ed4428bc142 62 #define CMD_VOP_6V06 0xB2
wupinxian 5:7ed4428bc142 63 #define CMD_VOP_7V38 0xC8
wupinxian 5:7ed4428bc142 64
wupinxian 5:7ed4428bc142 65 // LCD Characteristics
wupinxian 5:7ed4428bc142 66 #define LCD_FREQ 2000000
wupinxian 5:7ed4428bc142 67 #define LCD_SPI_MODE 0x01
wupinxian 5:7ed4428bc142 68 #define LCD_SPI_BITS 0x08
wupinxian 5:7ed4428bc142 69 #define LCD_X_MAX 84
wupinxian 5:7ed4428bc142 70 #define LCD_Y_MAX 48
wupinxian 5:7ed4428bc142 71
wupinxian 5:7ed4428bc142 72 #define PIN_RST 0x00
wupinxian 5:7ed4428bc142 73 #define PIN_SCE 0x01
wupinxian 5:7ed4428bc142 74 #define PIN_DC 0x02
wupinxian 5:7ed4428bc142 75
wupinxian 5:7ed4428bc142 76 #include "mbed.h"
wupinxian 5:7ed4428bc142 77
wupinxian 5:7ed4428bc142 78 struct LcdPins
wupinxian 5:7ed4428bc142 79 {
wupinxian 5:7ed4428bc142 80 PinName mosi;
wupinxian 5:7ed4428bc142 81 PinName miso;
wupinxian 5:7ed4428bc142 82 PinName sclk;
wupinxian 5:7ed4428bc142 83 PinName dc;
wupinxian 5:7ed4428bc142 84 PinName sce;
wupinxian 5:7ed4428bc142 85 PinName rst;
wupinxian 5:7ed4428bc142 86 };
wupinxian 5:7ed4428bc142 87
wupinxian 5:7ed4428bc142 88 struct LcdFunctionSet
wupinxian 5:7ed4428bc142 89 {
wupinxian 5:7ed4428bc142 90 char PD;
wupinxian 5:7ed4428bc142 91 char V;
wupinxian 5:7ed4428bc142 92 char H;
wupinxian 5:7ed4428bc142 93 };
wupinxian 5:7ed4428bc142 94
wupinxian 5:7ed4428bc142 95 typedef char LcdFunctionChar;
wupinxian 5:7ed4428bc142 96 typedef char LcdTempControl;
wupinxian 5:7ed4428bc142 97 typedef char LcdDispControl;
wupinxian 5:7ed4428bc142 98 typedef char LcdBiasChar;
wupinxian 5:7ed4428bc142 99 typedef char LcdVopChar;
wupinxian 5:7ed4428bc142 100
wupinxian 5:7ed4428bc142 101 class NokiaLcd
wupinxian 5:7ed4428bc142 102 {
wupinxian 5:7ed4428bc142 103 public:
wupinxian 5:7ed4428bc142 104 NokiaLcd(LcdPins lcd_pinout);
wupinxian 5:7ed4428bc142 105 ~NokiaLcd();
wupinxian 5:7ed4428bc142 106
wupinxian 5:7ed4428bc142 107 public:
wupinxian 5:7ed4428bc142 108 void InitLcd();
wupinxian 5:7ed4428bc142 109 void ClearLcdMem();
wupinxian 5:7ed4428bc142 110 void ShutdownLcd();
wupinxian 5:7ed4428bc142 111 void SendFunction(char cmd);
wupinxian 5:7ed4428bc142 112 void TestLcd(char test_pattern);
wupinxian 5:7ed4428bc142 113 void SendDrawData(char data);
wupinxian 5:7ed4428bc142 114
wupinxian 5:7ed4428bc142 115 public:
wupinxian 5:7ed4428bc142 116 void DrawString(char* str);
wupinxian 5:7ed4428bc142 117 void DrawChar(char character);
wupinxian 5:7ed4428bc142 118 void SetXY(char x, char y);
wupinxian 5:7ed4428bc142 119 void DrawFrameChar(char character);
wupinxian 5:7ed4428bc142 120 void DrawNegFrameChar(char character);
wupinxian 5:7ed4428bc142 121 char* NumToStr(int num);
wupinxian 5:7ed4428bc142 122
wupinxian 5:7ed4428bc142 123 private:
wupinxian 5:7ed4428bc142 124 char CreateFunctionChar();
wupinxian 5:7ed4428bc142 125 void ResetLcd();
wupinxian 5:7ed4428bc142 126
wupinxian 5:7ed4428bc142 127 private:
wupinxian 5:7ed4428bc142 128 LcdFunctionChar FunctionChar;
wupinxian 5:7ed4428bc142 129 LcdTempControl TempControlChar;
wupinxian 5:7ed4428bc142 130 LcdDispControl DispControlChar;
wupinxian 5:7ed4428bc142 131 LcdFunctionSet FunctionSet;
wupinxian 5:7ed4428bc142 132 LcdBiasChar BiasChar;
wupinxian 5:7ed4428bc142 133 LcdVopChar VopChar;
wupinxian 5:7ed4428bc142 134 DigitalOut** Pins;
wupinxian 5:7ed4428bc142 135 SPI* LcdSpi;
wupinxian 5:7ed4428bc142 136
wupinxian 5:7ed4428bc142 137 };
wupinxian 5:7ed4428bc142 138
wupinxian 5:7ed4428bc142 139 const char FONT_6x6[570] = //should be 564 total char
wupinxian 5:7ed4428bc142 140 {
wupinxian 5:7ed4428bc142 141 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SPACE 1
wupinxian 5:7ed4428bc142 142 0x00, 0x06, 0x2F, 0x06, 0x00, 0x00, // ! 2
wupinxian 5:7ed4428bc142 143 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, // " 3
wupinxian 5:7ed4428bc142 144 0x14, 0x3E, 0x14, 0x3E, 0x14, 0x00, // # 4
wupinxian 5:7ed4428bc142 145 0x2E, 0x2A, 0x3F, 0x2A, 0x3A, 0x00, // $ 5
wupinxian 5:7ed4428bc142 146 0x26, 0x16, 0x08, 0x34, 0x32, 0x00, // % 6
wupinxian 5:7ed4428bc142 147 0x34, 0x2A, 0x3C, 0x18, 0x28, 0x00, // & 7
wupinxian 5:7ed4428bc142 148 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, // ' 8
wupinxian 5:7ed4428bc142 149 0x00, 0x00, 0x1C, 0x36, 0x22, 0x00, // ( 9
wupinxian 5:7ed4428bc142 150 0x22, 0x36, 0x1C, 0x00, 0x00, 0x00, // ) 10
wupinxian 5:7ed4428bc142 151 0x24, 0x18, 0x0E, 0x18, 0x24, 0x00, // * 11
wupinxian 5:7ed4428bc142 152 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, // + 12
wupinxian 5:7ed4428bc142 153 0x20, 0x30, 0x00, 0x00, 0x00, 0x00, // , 13
wupinxian 5:7ed4428bc142 154 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, // - 14
wupinxian 5:7ed4428bc142 155 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // . 15
wupinxian 5:7ed4428bc142 156 0x30, 0x18, 0x0C, 0x06, 0x00, 0x00, // / 16
wupinxian 5:7ed4428bc142 157 0x00, 0x1C, 0x22, 0x22, 0x1C, 0x00, // 0 17
wupinxian 5:7ed4428bc142 158 0x00, 0x24, 0x3E, 0x20, 0x00, 0x00, // 1 18
wupinxian 5:7ed4428bc142 159 0x3A, 0x2A, 0x2A, 0x2A, 0x2E, 0x00, // 2 19
wupinxian 5:7ed4428bc142 160 0x22, 0x2A, 0x2A, 0x2A, 0x3E, 0x00, // 3 20
wupinxian 5:7ed4428bc142 161 0x0E, 0x08, 0x08, 0x3E, 0x08, 0x00, // 4 21
wupinxian 5:7ed4428bc142 162 0x2E, 0x2A, 0x2A, 0x2A, 0x3A, 0x00, // 5 22
wupinxian 5:7ed4428bc142 163 0x3E, 0x2A, 0x2A, 0x2A, 0x3A, 0x00, // 6 23
wupinxian 5:7ed4428bc142 164 0x22, 0x12, 0x0A, 0x06, 0x02, 0x00, // 7 24
wupinxian 5:7ed4428bc142 165 0x3E, 0x2A, 0x2A, 0x2A, 0x3E, 0x00, // 8 25
wupinxian 5:7ed4428bc142 166 0x00, 0x2E, 0x2A, 0x2A, 0x3E, 0x00, // 9 26
wupinxian 5:7ed4428bc142 167 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, // : 27
wupinxian 5:7ed4428bc142 168 0x00, 0x20, 0x14, 0x00, 0x00, 0x00, // ; 28
wupinxian 5:7ed4428bc142 169 0x00, 0x00, 0x08, 0x14, 0x22, 0x00, // < 29
wupinxian 5:7ed4428bc142 170 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, // = 30
wupinxian 5:7ed4428bc142 171 0x22, 0x14, 0x08, 0x00, 0x00, 0x00, // > 31
wupinxian 5:7ed4428bc142 172 0x06, 0x01, 0x2D, 0x06, 0x00, 0x00, // ? 32
wupinxian 5:7ed4428bc142 173 0x1E, 0x23, 0x19, 0x35, 0x3E, 0x00, // @ 33
wupinxian 5:7ed4428bc142 174 0x3C, 0x0A, 0x0A, 0x0A, 0x3C, 0x00, // A 34
wupinxian 5:7ed4428bc142 175 0x3E, 0x2A, 0x2A, 0x2A, 0x1C, 0x00, // B 35
wupinxian 5:7ed4428bc142 176 0x1C, 0x22, 0x22, 0x22, 0x22, 0x00, // C 36
wupinxian 5:7ed4428bc142 177 0x3E, 0x22, 0x22, 0x22, 0x1C, 0x00, // D 37
wupinxian 5:7ed4428bc142 178 0x3E, 0x2A, 0x2A, 0x2A, 0x22, 0x00, // E 38
wupinxian 5:7ed4428bc142 179 0x3E, 0x0A, 0x0A, 0x0A, 0x02, 0x00, // F 39
wupinxian 5:7ed4428bc142 180 0x1C, 0x22, 0x2A, 0x2A, 0x18, 0x00, // G 40
wupinxian 5:7ed4428bc142 181 0x3E, 0x08, 0x08, 0x08, 0x3E, 0x00, // H
wupinxian 5:7ed4428bc142 182 0x22, 0x22, 0x3E, 0x22, 0x22, 0x00, // I
wupinxian 5:7ed4428bc142 183 0x10, 0x22, 0x22, 0x1E, 0x02, 0x00, // J
wupinxian 5:7ed4428bc142 184 0x3E, 0x08, 0x14, 0x22, 0x00, 0x00, // K
wupinxian 5:7ed4428bc142 185 0x00, 0x3E, 0x20, 0x20, 0x20, 0x00, // L 45
wupinxian 5:7ed4428bc142 186 0x3E, 0x04, 0x08, 0x04, 0x3E, 0x00, // M
wupinxian 5:7ed4428bc142 187 0x3C, 0x02, 0x02, 0x02, 0x3C, 0x00, // N
wupinxian 5:7ed4428bc142 188 0x1C, 0x22, 0x22, 0x22, 0x1C, 0x00, // O
wupinxian 5:7ed4428bc142 189 0x3E, 0x0A, 0x0A, 0x04, 0x00, 0x00, // P
wupinxian 5:7ed4428bc142 190 0x1C, 0x22, 0x32, 0x3C, 0x20, 0x00, // Q 50
wupinxian 5:7ed4428bc142 191 0x3E, 0x0A, 0x0A, 0x1A, 0x24, 0x00, // R
wupinxian 5:7ed4428bc142 192 0x24, 0x2A, 0x2A, 0x2A, 0x12, 0x00, // S
wupinxian 5:7ed4428bc142 193 0x02, 0x02, 0x3E, 0x02, 0x02, 0x00, // T
wupinxian 5:7ed4428bc142 194 0x1E, 0x20, 0x20, 0x20, 0x1E, 0x00, // U
wupinxian 5:7ed4428bc142 195 0x06, 0x18, 0x20, 0x18, 0x06, 0x00, // V 55
wupinxian 5:7ed4428bc142 196 0x0E, 0x30, 0x18, 0x30, 0x0E, 0x00, // W
wupinxian 5:7ed4428bc142 197 0x22, 0x14, 0x08, 0x14, 0x22, 0x00, // X
wupinxian 5:7ed4428bc142 198 0x02, 0x04, 0x38, 0x04, 0x02, 0x00, // Y
wupinxian 5:7ed4428bc142 199 0x22, 0x32, 0x2A, 0x26, 0x22, 0x00, // Z
wupinxian 5:7ed4428bc142 200 0x00, 0x00, 0x00, 0x3E, 0x22, 0x00, // [ 60
wupinxian 5:7ed4428bc142 201 0x06, 0x0C, 0x18, 0x30, 0x00, 0x00, // backslash
wupinxian 5:7ed4428bc142 202 0x22, 0x3E, 0x00, 0x00, 0x00, 0x00, // ]
wupinxian 5:7ed4428bc142 203 0x00, 0x04, 0x02, 0x02, 0x04, 0x00, // ^
wupinxian 5:7ed4428bc142 204 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, // _
wupinxian 5:7ed4428bc142 205 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, // ` 65
wupinxian 5:7ed4428bc142 206 0x18, 0x24, 0x14, 0x38, 0x00, 0x00, // a
wupinxian 5:7ed4428bc142 207 0x1E, 0x28, 0x28, 0x10, 0x00, 0x00, // b
wupinxian 5:7ed4428bc142 208 0x18, 0x24, 0x24, 0x00, 0x00, 0x00, // c
wupinxian 5:7ed4428bc142 209 0x10, 0x28, 0x28, 0x1E, 0x00, 0x00, // d
wupinxian 5:7ed4428bc142 210 0x18, 0x2C, 0x2C, 0x08, 0x00, 0x00, // e 70
wupinxian 5:7ed4428bc142 211 0x00, 0x3C, 0x12, 0x04, 0x00, 0x00, // f
wupinxian 5:7ed4428bc142 212 0x24, 0x2A, 0x1E, 0x00, 0x00, 0x00, // g
wupinxian 5:7ed4428bc142 213 0x3E, 0x08, 0x30, 0x00, 0x00, 0x00, // h
wupinxian 5:7ed4428bc142 214 0x00, 0x3A, 0x00, 0x00, 0x00, 0x00, // i
wupinxian 5:7ed4428bc142 215 0x10, 0x20, 0x1A, 0x00, 0x00, 0x00, // j 75
wupinxian 5:7ed4428bc142 216 0x3E, 0x10, 0x2C, 0x20, 0x00, 0x00, // k
wupinxian 5:7ed4428bc142 217 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, // l
wupinxian 5:7ed4428bc142 218 0x38, 0x08, 0x18, 0x08, 0x30, 0x00, // m
wupinxian 5:7ed4428bc142 219 0x30, 0x08, 0x08, 0x30, 0x00, 0x00, // n
wupinxian 5:7ed4428bc142 220 0x10, 0x28, 0x28, 0x10, 0x00, 0x00, // o 80
wupinxian 5:7ed4428bc142 221 0x38, 0x14, 0x14, 0x08, 0x00, 0x00, // p
wupinxian 5:7ed4428bc142 222 0x08, 0x14, 0x14, 0x38, 0x00, 0x00, // q
wupinxian 5:7ed4428bc142 223 0x3C, 0x08, 0x04, 0x00, 0x00, 0x00, // r
wupinxian 5:7ed4428bc142 224 0x2C, 0x34, 0x00, 0x00, 0x00, 0x00, // s
wupinxian 5:7ed4428bc142 225 0x08, 0x3C, 0x28, 0x00, 0x00, 0x00, // t 85
wupinxian 5:7ed4428bc142 226 0x18, 0x20, 0x20, 0x18, 0x00, 0x00, // u
wupinxian 5:7ed4428bc142 227 0x08, 0x10, 0x20, 0x10, 0x08, 0x00, // v
wupinxian 5:7ed4428bc142 228 0x18, 0x20, 0x10, 0x20, 0x18, 0x00, // w
wupinxian 5:7ed4428bc142 229 0x28, 0x10, 0x28, 0x00, 0x00, 0x00, // x
wupinxian 5:7ed4428bc142 230 0x2C, 0x30, 0x1C, 0x00, 0x00, 0x00, // y 90
wupinxian 5:7ed4428bc142 231 0x24, 0x34, 0x2C, 0x24, 0x00, 0x00, // z
wupinxian 5:7ed4428bc142 232 0x00, 0x00, 0x08, 0x3E, 0x22, 0x00, // {
wupinxian 5:7ed4428bc142 233 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, // |
wupinxian 5:7ed4428bc142 234 0x22, 0x3E, 0x08, 0x00, 0x00, 0x00, // }
wupinxian 5:7ed4428bc142 235 0x10, 0x08, 0x18, 0x10, 0x08, 0x00, // ~ 95
wupinxian 5:7ed4428bc142 236 };
wupinxian 5:7ed4428bc142 237
wupinxian 5:7ed4428bc142 238 #endif
wupinxian 5:7ed4428bc142 239
wupinxian 5:7ed4428bc142 240
wupinxian 5:7ed4428bc142 241
wupinxian 5:7ed4428bc142 242
wupinxian 5:7ed4428bc142 243 // File: main.cpp
wupinxian 5:7ed4428bc142 244 // Author: Chris Yan
wupinxian 5:7ed4428bc142 245 // Created: January, 2012
wupinxian 5:7ed4428bc142 246 // Revised:
wupinxian 5:7ed4428bc142 247 // Desc: A basic LCD output test which uses the NXP LPC1768's SPI interface to
wupinxian 5:7ed4428bc142 248 // display pixels, characters, and numbers on the Nokia 5110 LCD.
wupinxian 5:7ed4428bc142 249 // Created using a sparkfun breakout board with integrated Phillips 8544 driver
wupinxian 5:7ed4428bc142 250 // for 48x84 LCDs.
wupinxian 5:7ed4428bc142 251
wupinxian 5:7ed4428bc142 252 //#include "mbed.h"
wupinxian 5:7ed4428bc142 253 //#include "NOKIA_5110.h"
wupinxian 5:7ed4428bc142 254
wupinxian 5:7ed4428bc142 255 //int main()
wupinxian 5:7ed4428bc142 256 //{
wupinxian 5:7ed4428bc142 257 // Init the data structures and NokiaLcd class
wupinxian 5:7ed4428bc142 258 // LcdPins myPins;
wupinxian 5:7ed4428bc142 259 // myPins.sce = p8;
wupinxian 5:7ed4428bc142 260 // myPins.rst = p9;
wupinxian 5:7ed4428bc142 261 // myPins.dc = p10;
wupinxian 5:7ed4428bc142 262 // myPins.mosi = p11;
wupinxian 5:7ed4428bc142 263 // myPins.miso = NC;
wupinxian 5:7ed4428bc142 264 // myPins.sclk = p13;
wupinxian 5:7ed4428bc142 265
wupinxian 5:7ed4428bc142 266 // NokiaLcd myLcd( myPins );
wupinxian 5:7ed4428bc142 267
wupinxian 5:7ed4428bc142 268 // Start the LCD
wupinxian 5:7ed4428bc142 269 // myLcd.InitLcd();
wupinxian 5:7ed4428bc142 270
wupinxian 5:7ed4428bc142 271 // Draw a test pattern on the LCD and stall for 15 seconds
wupinxian 5:7ed4428bc142 272 // myLcd.TestLcd( 0xAA );
wupinxian 5:7ed4428bc142 273 // wait( 15 );
wupinxian 5:7ed4428bc142 274
wupinxian 5:7ed4428bc142 275 // Turn off the LCD and enter an endless loop
wupinxian 5:7ed4428bc142 276 // myLcd.ShutdownLcd();
wupinxian 5:7ed4428bc142 277 // while( 1 )
wupinxian 5:7ed4428bc142 278 // {
wupinxian 5:7ed4428bc142 279 //dance
wupinxian 5:7ed4428bc142 280 // }
wupinxian 5:7ed4428bc142 281 //}