Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 729fd7b

Browse files
authoredAug 2, 2016
add basic functionalities of SS1289 LCD driver
1. Straight Line 2. Circle 3. Box 4. String 5. Character
1 parent 415061f commit 729fd7b

File tree

6 files changed

+1033
-0
lines changed

6 files changed

+1033
-0
lines changed
 

‎FONT.H

+206
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
#ifndef __FONT_H
2+
#define __FONT_H
3+
//
4+
//!
5+
//! Frequently used ASCII table
6+
//! offset: 32
7+
//! ASCII character set
8+
//
9+
//! Character size:12*6
10+
const unsigned char ASCII_1206[95][12]={
11+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
12+
{0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x00,0x04,0x00,0x00},/*"!",1*/
13+
{0x00,0x14,0x0A,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*""",2*/
14+
{0x00,0x00,0x14,0x14,0x3F,0x14,0x0A,0x3F,0x0A,0x0A,0x00,0x00},/*"#",3*/
15+
{0x00,0x04,0x1E,0x15,0x05,0x06,0x0C,0x14,0x15,0x0F,0x04,0x00},/*"$",4*/
16+
{0x00,0x00,0x12,0x15,0x0D,0x0A,0x14,0x2C,0x2A,0x12,0x00,0x00},/*"%",5*/
17+
{0x00,0x00,0x04,0x0A,0x0A,0x1E,0x15,0x15,0x09,0x36,0x00,0x00},/*"&",6*/
18+
{0x00,0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
19+
{0x00,0x20,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x20,0x00},/*"(",8*/
20+
{0x00,0x02,0x04,0x08,0x08,0x08,0x08,0x08,0x08,0x04,0x02,0x00},/*")",9*/
21+
{0x00,0x00,0x00,0x04,0x15,0x0E,0x0E,0x15,0x04,0x00,0x00,0x00},/*"*",10*/
22+
{0x00,0x00,0x04,0x04,0x04,0x1F,0x04,0x04,0x04,0x00,0x00,0x00},/*"+",11*/
23+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x01},/*",",12*/
24+
{0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00},/*"-",13*/
25+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00},/*".",14*/
26+
{0x00,0x10,0x08,0x08,0x08,0x04,0x04,0x02,0x02,0x02,0x01,0x00},/*"/",15*/
27+
{0x00,0x00,0x0E,0x11,0x11,0x11,0x11,0x11,0x11,0x0E,0x00,0x00},/*"0",16*/
28+
{0x00,0x00,0x04,0x06,0x04,0x04,0x04,0x04,0x04,0x0E,0x00,0x00},/*"1",17*/
29+
{0x00,0x00,0x0E,0x11,0x11,0x08,0x04,0x02,0x01,0x1F,0x00,0x00},/*"2",18*/
30+
{0x00,0x00,0x0E,0x11,0x10,0x0C,0x10,0x10,0x11,0x0E,0x00,0x00},/*"3",19*/
31+
{0x00,0x00,0x08,0x0C,0x0A,0x0A,0x09,0x1E,0x08,0x18,0x00,0x00},/*"4",20*/
32+
{0x00,0x00,0x1F,0x01,0x01,0x0F,0x10,0x10,0x11,0x0E,0x00,0x00},/*"5",21*/
33+
{0x00,0x00,0x0E,0x09,0x01,0x0F,0x11,0x11,0x11,0x0E,0x00,0x00},/*"6",22*/
34+
{0x00,0x00,0x1F,0x09,0x08,0x04,0x04,0x04,0x04,0x04,0x00,0x00},/*"7",23*/
35+
{0x00,0x00,0x0E,0x11,0x11,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00},/*"8",24*/
36+
{0x00,0x00,0x0E,0x11,0x11,0x11,0x1E,0x10,0x12,0x0E,0x00,0x00},/*"9",25*/
37+
{0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x04,0x00,0x00},/*":",26*/
38+
{0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x04,0x00},/*";",27*/
39+
{0x00,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x00,0x00},/*"<",28*/
40+
{0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x1F,0x00,0x00,0x00,0x00},/*"=",29*/
41+
{0x00,0x02,0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x02,0x00,0x00},/*">",30*/
42+
{0x00,0x00,0x0E,0x11,0x11,0x08,0x04,0x04,0x00,0x04,0x00,0x00},/*"?",31*/
43+
{0x00,0x00,0x0E,0x11,0x19,0x15,0x15,0x1D,0x01,0x1E,0x00,0x00},/*"@",32*/
44+
{0x00,0x00,0x04,0x04,0x0C,0x0A,0x0A,0x1E,0x12,0x33,0x00,0x00},/*"A",33*/
45+
{0x00,0x00,0x0F,0x12,0x12,0x0E,0x12,0x12,0x12,0x0F,0x00,0x00},/*"B",34*/
46+
{0x00,0x00,0x1E,0x11,0x01,0x01,0x01,0x01,0x11,0x0E,0x00,0x00},/*"C",35*/
47+
{0x00,0x00,0x0F,0x12,0x12,0x12,0x12,0x12,0x12,0x0F,0x00,0x00},/*"D",36*/
48+
{0x00,0x00,0x1F,0x12,0x0A,0x0E,0x0A,0x02,0x12,0x1F,0x00,0x00},/*"E",37*/
49+
{0x00,0x00,0x1F,0x12,0x0A,0x0E,0x0A,0x02,0x02,0x07,0x00,0x00},/*"F",38*/
50+
{0x00,0x00,0x1C,0x12,0x01,0x01,0x39,0x11,0x12,0x0C,0x00,0x00},/*"G",39*/
51+
{0x00,0x00,0x33,0x12,0x12,0x1E,0x12,0x12,0x12,0x33,0x00,0x00},/*"H",40*/
52+
{0x00,0x00,0x1F,0x04,0x04,0x04,0x04,0x04,0x04,0x1F,0x00,0x00},/*"I",41*/
53+
{0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x09,0x07,0x00},/*"J",42*/
54+
{0x00,0x00,0x37,0x12,0x0A,0x06,0x0A,0x0A,0x12,0x37,0x00,0x00},/*"K",43*/
55+
{0x00,0x00,0x07,0x02,0x02,0x02,0x02,0x02,0x22,0x3F,0x00,0x00},/*"L",44*/
56+
{0x00,0x00,0x1B,0x1B,0x1B,0x1B,0x15,0x15,0x15,0x15,0x00,0x00},/*"M",45*/
57+
{0x00,0x00,0x3B,0x12,0x16,0x16,0x1A,0x1A,0x12,0x17,0x00,0x00},/*"N",46*/
58+
{0x00,0x00,0x0E,0x11,0x11,0x11,0x11,0x11,0x11,0x0E,0x00,0x00},/*"O",47*/
59+
{0x00,0x00,0x0F,0x12,0x12,0x0E,0x02,0x02,0x02,0x07,0x00,0x00},/*"P",48*/
60+
{0x00,0x00,0x0E,0x11,0x11,0x11,0x11,0x17,0x19,0x0E,0x18,0x00},/*"Q",49*/
61+
{0x00,0x00,0x0F,0x12,0x12,0x0E,0x0A,0x12,0x12,0x37,0x00,0x00},/*"R",50*/
62+
{0x00,0x00,0x1E,0x11,0x01,0x06,0x08,0x10,0x11,0x0F,0x00,0x00},/*"S",51*/
63+
{0x00,0x00,0x1F,0x15,0x04,0x04,0x04,0x04,0x04,0x0E,0x00,0x00},/*"T",52*/
64+
{0x00,0x00,0x33,0x12,0x12,0x12,0x12,0x12,0x12,0x0C,0x00,0x00},/*"U",53*/
65+
{0x00,0x00,0x33,0x12,0x12,0x0A,0x0A,0x0C,0x04,0x04,0x00,0x00},/*"V",54*/
66+
{0x00,0x00,0x15,0x15,0x15,0x0E,0x0A,0x0A,0x0A,0x0A,0x00,0x00},/*"W",55*/
67+
{0x00,0x00,0x1B,0x0A,0x0A,0x04,0x04,0x0A,0x0A,0x1B,0x00,0x00},/*"X",56*/
68+
{0x00,0x00,0x1B,0x0A,0x0A,0x04,0x04,0x04,0x04,0x0E,0x00,0x00},/*"Y",57*/
69+
{0x00,0x00,0x1F,0x09,0x08,0x04,0x04,0x02,0x12,0x1F,0x00,0x00},/*"Z",58*/
70+
{0x00,0x1C,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x1C,0x00},/*"[",59*/
71+
{0x00,0x02,0x02,0x02,0x04,0x04,0x08,0x08,0x08,0x10,0x00,0x00},/*"\",60*/
72+
{0x00,0x0E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0E,0x00},/*"]",61*/
73+
{0x00,0x04,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
74+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F},/*"_",63*/
75+
{0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
76+
{0x00,0x00,0x00,0x00,0x00,0x0C,0x12,0x1C,0x12,0x3C,0x00,0x00},/*"a",65*/
77+
{0x00,0x00,0x03,0x02,0x02,0x0E,0x12,0x12,0x12,0x0E,0x00,0x00},/*"b",66*/
78+
{0x00,0x00,0x00,0x00,0x00,0x1C,0x12,0x02,0x02,0x1C,0x00,0x00},/*"c",67*/
79+
{0x00,0x00,0x18,0x10,0x10,0x1C,0x12,0x12,0x12,0x3C,0x00,0x00},/*"d",68*/
80+
{0x00,0x00,0x00,0x00,0x00,0x0C,0x12,0x1E,0x02,0x1C,0x00,0x00},/*"e",69*/
81+
{0x00,0x00,0x38,0x04,0x04,0x1E,0x04,0x04,0x04,0x1E,0x00,0x00},/*"f",70*/
82+
{0x00,0x00,0x00,0x00,0x00,0x3C,0x12,0x0C,0x02,0x1E,0x22,0x1C},/*"g",71*/
83+
{0x00,0x00,0x03,0x02,0x02,0x0E,0x12,0x12,0x12,0x37,0x00,0x00},/*"h",72*/
84+
{0x00,0x00,0x04,0x00,0x00,0x06,0x04,0x04,0x04,0x0E,0x00,0x00},/*"i",73*/
85+
{0x00,0x00,0x08,0x00,0x00,0x0C,0x08,0x08,0x08,0x08,0x08,0x07},/*"j",74*/
86+
{0x00,0x00,0x03,0x02,0x02,0x3A,0x0A,0x0E,0x12,0x37,0x00,0x00},/*"k",75*/
87+
{0x00,0x00,0x07,0x04,0x04,0x04,0x04,0x04,0x04,0x1F,0x00,0x00},/*"l",76*/
88+
{0x00,0x00,0x00,0x00,0x00,0x0F,0x15,0x15,0x15,0x15,0x00,0x00},/*"m",77*/
89+
{0x00,0x00,0x00,0x00,0x00,0x0F,0x12,0x12,0x12,0x37,0x00,0x00},/*"n",78*/
90+
{0x00,0x00,0x00,0x00,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00,0x00},/*"o",79*/
91+
{0x00,0x00,0x00,0x00,0x00,0x0F,0x12,0x12,0x12,0x0E,0x02,0x07},/*"p",80*/
92+
{0x00,0x00,0x00,0x00,0x00,0x1C,0x12,0x12,0x12,0x1C,0x10,0x38},/*"q",81*/
93+
{0x00,0x00,0x00,0x00,0x00,0x1B,0x06,0x02,0x02,0x07,0x00,0x00},/*"r",82*/
94+
{0x00,0x00,0x00,0x00,0x00,0x1E,0x02,0x0C,0x10,0x1E,0x00,0x00},/*"s",83*/
95+
{0x00,0x00,0x00,0x04,0x04,0x0E,0x04,0x04,0x04,0x18,0x00,0x00},/*"t",84*/
96+
{0x00,0x00,0x00,0x00,0x00,0x1B,0x12,0x12,0x12,0x3C,0x00,0x00},/*"u",85*/
97+
{0x00,0x00,0x00,0x00,0x00,0x37,0x12,0x0A,0x0C,0x04,0x00,0x00},/*"v",86*/
98+
{0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x0E,0x0A,0x0A,0x00,0x00},/*"w",87*/
99+
{0x00,0x00,0x00,0x00,0x00,0x1B,0x0A,0x04,0x0A,0x1B,0x00,0x00},/*"x",88*/
100+
{0x00,0x00,0x00,0x00,0x00,0x37,0x12,0x0A,0x0C,0x04,0x04,0x03},/*"y",89*/
101+
{0x00,0x00,0x00,0x00,0x00,0x1E,0x08,0x04,0x04,0x1E,0x00,0x00},/*"z",90*/
102+
{0x00,0x18,0x08,0x08,0x08,0x04,0x08,0x08,0x08,0x08,0x18,0x00},/*"{",91*/
103+
{0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08},/*"|",92*/
104+
{0x00,0x06,0x04,0x04,0x04,0x08,0x04,0x04,0x04,0x04,0x06,0x00},/*"}",93*/
105+
{0x02,0x25,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} /*"~",94*/
106+
};
107+
108+
//! Character size: 16*8
109+
const unsigned char ASCII_1608[95][16]={
110+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
111+
{0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x18,0x18,0x00,0x00},/*"!",1*/
112+
{0x00,0x48,0x6C,0x24,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*""",2*/
113+
{0x00,0x00,0x00,0x24,0x24,0x24,0x7F,0x12,0x12,0x12,0x7F,0x12,0x12,0x12,0x00,0x00},/*"#",3*/
114+
{0x00,0x00,0x08,0x1C,0x2A,0x2A,0x0A,0x0C,0x18,0x28,0x28,0x2A,0x2A,0x1C,0x08,0x08},/*"$",4*/
115+
{0x00,0x00,0x00,0x22,0x25,0x15,0x15,0x15,0x2A,0x58,0x54,0x54,0x54,0x22,0x00,0x00},/*"%",5*/
116+
{0x00,0x00,0x00,0x0C,0x12,0x12,0x12,0x0A,0x76,0x25,0x29,0x11,0x91,0x6E,0x00,0x00},/*"&",6*/
117+
{0x00,0x06,0x06,0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
118+
{0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x00},/*"(",8*/
119+
{0x00,0x02,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,0x02,0x00},/*")",9*/
120+
{0x00,0x00,0x00,0x00,0x08,0x08,0x6B,0x1C,0x1C,0x6B,0x08,0x08,0x00,0x00,0x00,0x00},/*"*",10*/
121+
{0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x7F,0x08,0x08,0x08,0x08,0x00,0x00,0x00},/*"+",11*/
122+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x04,0x03},/*",",12*/
123+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"-",13*/
124+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x00,0x00},/*".",14*/
125+
{0x00,0x00,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x00},/*"/",15*/
126+
{0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00},/*"0",16*/
127+
{0x00,0x00,0x00,0x08,0x0E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00},/*"1",17*/
128+
{0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x20,0x20,0x10,0x08,0x04,0x42,0x7E,0x00,0x00},/*"2",18*/
129+
{0x00,0x00,0x00,0x3C,0x42,0x42,0x20,0x18,0x20,0x40,0x40,0x42,0x22,0x1C,0x00,0x00},/*"3",19*/
130+
{0x00,0x00,0x00,0x20,0x30,0x28,0x24,0x24,0x22,0x22,0x7E,0x20,0x20,0x78,0x00,0x00},/*"4",20*/
131+
{0x00,0x00,0x00,0x7E,0x02,0x02,0x02,0x1A,0x26,0x40,0x40,0x42,0x22,0x1C,0x00,0x00},/*"5",21*/
132+
{0x00,0x00,0x00,0x38,0x24,0x02,0x02,0x1A,0x26,0x42,0x42,0x42,0x24,0x18,0x00,0x00},/*"6",22*/
133+
{0x00,0x00,0x00,0x7E,0x22,0x22,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00},/*"7",23*/
134+
{0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x3C,0x00,0x00},/*"8",24*/
135+
{0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x64,0x58,0x40,0x40,0x24,0x1C,0x00,0x00},/*"9",25*/
136+
{0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00},/*":",26*/
137+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x04},/*";",27*/
138+
{0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x40,0x00,0x00},/*"<",28*/
139+
{0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00},/*"=",29*/
140+
{0x00,0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x02,0x00,0x00},/*">",30*/
141+
{0x00,0x00,0x00,0x3C,0x42,0x42,0x46,0x40,0x20,0x10,0x10,0x00,0x18,0x18,0x00,0x00},/*"?",31*/
142+
{0x00,0x00,0x00,0x1C,0x22,0x5A,0x55,0x55,0x55,0x55,0x2D,0x42,0x22,0x1C,0x00,0x00},/*"@",32*/
143+
{0x00,0x00,0x00,0x08,0x08,0x18,0x14,0x14,0x24,0x3C,0x22,0x42,0x42,0xE7,0x00,0x00},/*"A",33*/
144+
{0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x1E,0x22,0x42,0x42,0x42,0x22,0x1F,0x00,0x00},/*"B",34*/
145+
{0x00,0x00,0x00,0x7C,0x42,0x42,0x01,0x01,0x01,0x01,0x01,0x42,0x22,0x1C,0x00,0x00},/*"C",35*/
146+
{0x00,0x00,0x00,0x1F,0x22,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1F,0x00,0x00},/*"D",36*/
147+
{0x00,0x00,0x00,0x3F,0x42,0x12,0x12,0x1E,0x12,0x12,0x02,0x42,0x42,0x3F,0x00,0x00},/*"E",37*/
148+
{0x00,0x00,0x00,0x3F,0x42,0x12,0x12,0x1E,0x12,0x12,0x02,0x02,0x02,0x07,0x00,0x00},/*"F",38*/
149+
{0x00,0x00,0x00,0x3C,0x22,0x22,0x01,0x01,0x01,0x71,0x21,0x22,0x22,0x1C,0x00,0x00},/*"G",39*/
150+
{0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42,0xE7,0x00,0x00},/*"H",40*/
151+
{0x00,0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00},/*"I",41*/
152+
{0x00,0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x0F},/*"J",42*/
153+
{0x00,0x00,0x00,0x77,0x22,0x12,0x0A,0x0E,0x0A,0x12,0x12,0x22,0x22,0x77,0x00,0x00},/*"K",43*/
154+
{0x00,0x00,0x00,0x07,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x42,0x7F,0x00,0x00},/*"L",44*/
155+
{0x00,0x00,0x00,0x77,0x36,0x36,0x36,0x36,0x2A,0x2A,0x2A,0x2A,0x2A,0x6B,0x00,0x00},/*"M",45*/
156+
{0x00,0x00,0x00,0xE3,0x46,0x46,0x4A,0x4A,0x52,0x52,0x52,0x62,0x62,0x47,0x00,0x00},/*"N",46*/
157+
{0x00,0x00,0x00,0x1C,0x22,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x22,0x1C,0x00,0x00},/*"O",47*/
158+
{0x00,0x00,0x00,0x3F,0x42,0x42,0x42,0x42,0x3E,0x02,0x02,0x02,0x02,0x07,0x00,0x00},/*"P",48*/
159+
{0x00,0x00,0x00,0x1C,0x22,0x41,0x41,0x41,0x41,0x41,0x4D,0x53,0x32,0x1C,0x60,0x00},/*"Q",49*/
160+
{0x00,0x00,0x00,0x3F,0x42,0x42,0x42,0x3E,0x12,0x12,0x22,0x22,0x42,0xC7,0x00,0x00},/*"R",50*/
161+
{0x00,0x00,0x00,0x7C,0x42,0x42,0x02,0x04,0x18,0x20,0x40,0x42,0x42,0x3E,0x00,0x00},/*"S",51*/
162+
{0x00,0x00,0x00,0x7F,0x49,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00},/*"T",52*/
163+
{0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00},/*"U",53*/
164+
{0x00,0x00,0x00,0xE7,0x42,0x42,0x22,0x24,0x24,0x14,0x14,0x18,0x08,0x08,0x00,0x00},/*"V",54*/
165+
{0x00,0x00,0x00,0x6B,0x49,0x49,0x49,0x49,0x55,0x55,0x36,0x22,0x22,0x22,0x00,0x00},/*"W",55*/
166+
{0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x18,0x18,0x18,0x24,0x24,0x42,0xE7,0x00,0x00},/*"X",56*/
167+
{0x00,0x00,0x00,0x77,0x22,0x22,0x14,0x14,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00},/*"Y",57*/
168+
{0x00,0x00,0x00,0x7E,0x21,0x20,0x10,0x10,0x08,0x04,0x04,0x42,0x42,0x3F,0x00,0x00},/*"Z",58*/
169+
{0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78,0x00},/*"[",59*/
170+
{0x00,0x00,0x02,0x02,0x04,0x04,0x08,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x40,0x40},/*"\",60*/
171+
{0x00,0x1E,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1E,0x00},/*"]",61*/
172+
{0x00,0x38,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
173+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF},/*"_",63*/
174+
{0x00,0x06,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
175+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x78,0x44,0x42,0x42,0xFC,0x00,0x00},/*"a",65*/
176+
{0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x1A,0x26,0x42,0x42,0x42,0x26,0x1A,0x00,0x00},/*"b",66*/
177+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x02,0x02,0x02,0x44,0x38,0x00,0x00},/*"c",67*/
178+
{0x00,0x00,0x00,0x60,0x40,0x40,0x40,0x78,0x44,0x42,0x42,0x42,0x64,0xD8,0x00,0x00},/*"d",68*/
179+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x7E,0x02,0x02,0x42,0x3C,0x00,0x00},/*"e",69*/
180+
{0x00,0x00,0x00,0xF0,0x88,0x08,0x08,0x7E,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00},/*"f",70*/
181+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x22,0x22,0x1C,0x02,0x3C,0x42,0x42,0x3C},/*"g",71*/
182+
{0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x3A,0x46,0x42,0x42,0x42,0x42,0xE7,0x00,0x00},/*"h",72*/
183+
{0x00,0x00,0x00,0x0C,0x0C,0x00,0x00,0x0E,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00},/*"i",73*/
184+
{0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x1E},/*"j",74*/
185+
{0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x72,0x12,0x0A,0x16,0x12,0x22,0x77,0x00,0x00},/*"k",75*/
186+
{0x00,0x00,0x00,0x0E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00},/*"l",76*/
187+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x92,0x92,0x92,0x92,0x92,0xB7,0x00,0x00},/*"m",77*/
188+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3B,0x46,0x42,0x42,0x42,0x42,0xE7,0x00,0x00},/*"n",78*/
189+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00},/*"o",79*/
190+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1B,0x26,0x42,0x42,0x42,0x22,0x1E,0x02,0x07},/*"p",80*/
191+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x44,0x42,0x42,0x42,0x44,0x78,0x40,0xE0},/*"q",81*/
192+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x77,0x4C,0x04,0x04,0x04,0x04,0x1F,0x00,0x00},/*"r",82*/
193+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x42,0x02,0x3C,0x40,0x42,0x3E,0x00,0x00},/*"s",83*/
194+
{0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x3E,0x08,0x08,0x08,0x08,0x08,0x30,0x00,0x00},/*"t",84*/
195+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x42,0x42,0x42,0x42,0x62,0xDC,0x00,0x00},/*"u",85*/
196+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x14,0x08,0x08,0x00,0x00},/*"v",86*/
197+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEB,0x49,0x49,0x55,0x55,0x22,0x22,0x00,0x00},/*"w",87*/
198+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x24,0x18,0x18,0x18,0x24,0x6E,0x00,0x00},/*"x",88*/
199+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x14,0x18,0x08,0x08,0x07},/*"y",89*/
200+
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x22,0x10,0x08,0x08,0x44,0x7E,0x00,0x00},/*"z",90*/
201+
{0x00,0xC0,0x20,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0x20,0x20,0xC0,0x00},/*"{",91*/
202+
{0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10},/*"|",92*/
203+
{0x00,0x06,0x08,0x08,0x08,0x08,0x08,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x06,0x00},/*"}",93*/
204+
{0x0C,0x32,0xC2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"~",94*/
205+
};
206+
#endif

‎LCD_delay.c

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#include "LCD_delay.h"
2+
#include "lpc17xx_clkpwr.h"
3+
#include "lpc17xx_nvic.h"
4+
#include "lpc17xx_gpio.h"
5+
#include "lpc17xx_timer.h"
6+
7+
char resume;
8+
9+
uint32_t getPClock (uint32_t timernum)
10+
{
11+
uint32_t clkdlycnt;
12+
switch (timernum)
13+
{
14+
case 0:
15+
clkdlycnt = CLKPWR_GetPCLK (CLKPWR_PCLKSEL_TIMER0);
16+
break;
17+
18+
case 1:
19+
clkdlycnt = CLKPWR_GetPCLK (CLKPWR_PCLKSEL_TIMER1);
20+
break;
21+
22+
case 2:
23+
clkdlycnt = CLKPWR_GetPCLK (CLKPWR_PCLKSEL_TIMER2);
24+
break;
25+
26+
case 3:
27+
clkdlycnt = CLKPWR_GetPCLK (CLKPWR_PCLKSEL_TIMER3);
28+
break;
29+
}
30+
return clkdlycnt;
31+
}
32+
33+
uint32_t converUSecToVal (uint32_t timernum, uint32_t usec)
34+
{
35+
uint64_t clkdlycnt;
36+
37+
// Get Pclock of timer
38+
clkdlycnt = (uint64_t) getPClock(timernum);
39+
40+
clkdlycnt = (clkdlycnt * usec) / 1000000;
41+
return (uint32_t) clkdlycnt;
42+
}
43+
44+
void Timer0_init(uint32_t timer_val)
45+
{
46+
TIM_TIMERCFG_Type TMR0_Cfg;
47+
TIM_MATCHCFG_Type TMR0_Match;
48+
49+
/* On reset, Timer0/1 are enabled (PCTIM0/1 = 1), and Timer2/3 are disabled (PCTIM2/3 = 0).*/
50+
/* Initialize timer 0, prescale count time of 100uS */
51+
TMR0_Cfg.PrescaleOption = TIM_PRESCALE_USVAL;
52+
TMR0_Cfg.PrescaleValue = 100;
53+
/* Use channel 0, MR0 */
54+
TMR0_Match.MatchChannel = 0;
55+
/* Enable interrupt when MR0 matches the value in TC register */
56+
TMR0_Match.IntOnMatch = ENABLE;
57+
/* Enable reset on MR0: TIMER will reset if MR0 matches it */
58+
TMR0_Match.ResetOnMatch = TRUE;
59+
/* Don't stop on MR0 if MR0 matches it*/
60+
TMR0_Match.StopOnMatch = FALSE;
61+
/* Do nothing for external output pin if match (see cmsis help, there are another options) */
62+
TMR0_Match.ExtMatchOutputType = TIM_EXTMATCH_NOTHING;
63+
/* Set Match value, count value of 10000 (10000 * 100uS = 1000000us = 1s --> 1 Hz) */
64+
TMR0_Match.MatchValue = timer_val;
65+
/* Set configuration for Tim_config and Tim_MatchConfig */
66+
TIM_Init(LPC_TIM0, TIM_TIMER_MODE, &TMR0_Cfg);
67+
TIM_ConfigMatch(LPC_TIM0, &TMR0_Match);
68+
69+
/* Preemption = 1, sub-priority = 1 */
70+
NVIC_SetPriority(TIMER0_IRQn, ((0x01<<3)|0x01));
71+
/* Enable interrupt for timer 0 */
72+
NVIC_EnableIRQ(TIMER0_IRQn);
73+
/* Start timer 0 */
74+
TIM_Cmd(LPC_TIM0, ENABLE);
75+
}
76+
77+
void TIMER0_IRQHandler(void)
78+
{
79+
/* Clear Interrupt */
80+
TIM_ClearIntPending(LPC_TIM0,TIM_MR0_INT);
81+
/* Code...*/
82+
TIM_Cmd(LPC_TIM0, DISABLE);
83+
TIM_ResetCounter(LPC_TIM0);
84+
resume = 1;
85+
return;
86+
}
87+
88+
89+
void LCD_delay_ms(unsigned int delay_ms)
90+
{
91+
Timer0_init(delay_ms*10);
92+
while(!resume);
93+
resume = 0;
94+
}
95+
96+
97+

‎LCD_delay.h

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "lpc_types.h"
2+
void TIMER0_IRQHandler (void);
3+
uint32_t getPClock (uint32_t);
4+
uint32_t converUSecToVal (uint32_t, uint32_t);
5+
void Timer0_init(uint32_t);
6+
void delay_ms(unsigned int);

‎SSD1289.c

+454
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,454 @@
1+
#include "SSD1289.h"
2+
/*
3+
* LCD functions
4+
*/
5+
char *num2str(int num) {
6+
int i = 0, p = 0;
7+
char temp[11];
8+
for (i = 0; i < 10; i++) {
9+
temp[i] = ' ';
10+
str[i] = ' ';
11+
}
12+
temp[10] = '\0';
13+
if (num == 0) {
14+
str[0] = '0';
15+
str[1] = '\0';
16+
return str;
17+
}
18+
if (num < 0) {
19+
temp[0] = '-';
20+
num *= -1;
21+
} else
22+
temp[0] = ' ';
23+
i = 0;
24+
while (num > 0) {
25+
temp[9 - i] = (char) ((num % 10) + 48);
26+
num /= 10;
27+
i++;
28+
}
29+
for (i = 0; temp[i] != '\0'; i++) {
30+
if (temp[i] == ' ')
31+
continue;
32+
else {
33+
str[p] = temp[i];
34+
p++;
35+
}
36+
}
37+
str[p] = '\0';
38+
return str;
39+
}
40+
41+
void LCD_delay_us(int delay)
42+
{
43+
uint16_t i,us;
44+
for(i = 0;i<delay;i++)
45+
{
46+
us = 12;
47+
while (us--);
48+
}
49+
}
50+
51+
void LCD_delay_ms(int delay)
52+
{
53+
int i,j;
54+
for(i=0;i<delay;i++) {
55+
for(j=0;j<1000;j++)
56+
LCD_delay_us(1);
57+
}
58+
}
59+
60+
61+
void GPIO_WriteData(int port,unsigned short data)
62+
{
63+
GPIO_SetValue(port,data&0x00FF);
64+
GPIO_ClearValue(port,(~data)&0x00FF);
65+
}
66+
67+
void LCD_DrawRectangle(unsigned short x1,unsigned short y1,unsigned short x2,unsigned short y2,unsigned int colour)
68+
{
69+
unsigned short i,j;
70+
short dist_x,dist_y, inc_x,inc_y;
71+
info.foreground = colour;
72+
73+
dist_x = x2-x1;
74+
dist_y = y2-y1;
75+
if(dist_x < 0) {
76+
inc_x=-1;
77+
dist_x*=-1;
78+
}
79+
else
80+
inc_x=1;
81+
if(dist_y < 0) {
82+
inc_y=-1;
83+
dist_y*=-1;
84+
}
85+
else
86+
inc_y=1;
87+
88+
for(i=0;;) {
89+
for(j=0;;) {
90+
LCD_DrawDot(x1+i,y1+j);
91+
j+=inc_y;
92+
if(j<0) {
93+
if((j * -1) == dist_y)
94+
break;
95+
}
96+
else
97+
if(j == dist_y)
98+
break;
99+
}
100+
i+=inc_x;
101+
if(i<0) {
102+
if((i * -1) == dist_x)
103+
break;
104+
}
105+
else
106+
if(i == dist_y)
107+
break;
108+
109+
}
110+
}
111+
112+
#ifdef LAND_TIGERV2
113+
114+
void write_LCD(unsigned short data,char ch) /* ch = CMD(command), ch =DATA(data) */
115+
{
116+
GPIO_SetDir(LCD_PORT,LCD_DATA,1); /*Set P2.0 to P2.7 as output pins */
117+
GPIO_SetValue(LCD_CNTRL,LCD_DIR); /* Set Buffer Direction to WR */
118+
GPIO_ClearValue(LCD_CNTRL,LCD_EN); /* Enable buffer outputs */
119+
GPIO_SetValue(LCD_CNTRL,LCD_LE); /* Latch D00-D07 Transparent */
120+
GPIO_WriteData(LCD_PORT,data&0x00FF); /* Writing LSB */
121+
GPIO_ClearValue(LCD_CNTRL,LCD_LE); /* Latch D00-D07 */
122+
GPIO_WriteData(LCD_PORT,(data>>8)&0x00FF); /* Writing MSB */
123+
GPIO_ClearValue(LCD_CNTRL,CS); /* Select Device */
124+
switch(ch) {
125+
case CMD:
126+
GPIO_ClearValue(PORT0,RS); /* Select Control register */
127+
break;
128+
case DATA:
129+
GPIO_SetValue(PORT0,RS); /* Select Data register */
130+
break;
131+
}
132+
GPIO_ClearValue(LCD_CNTRL,WR); /* Start Writing */
133+
GPIO_SetValue(LCD_CNTRL,RD);
134+
GPIO_SetValue(LCD_CNTRL,WR); /*Stop writing */
135+
GPIO_SetValue(LCD_CNTRL,CS); /* de-select device */
136+
}
137+
138+
unsigned short read_LCD(unsigned char reg,unsigned char ch)
139+
{
140+
uint32_t PORT_VAL;
141+
unsigned short MSB,LSB;
142+
unsigned short dat=0;
143+
144+
switch(ch) {
145+
case CMD:
146+
write_LCD(reg,CMD);
147+
GPIO_ClearValue(LCD_CNTRL,RS); /* Select Control register */
148+
break;
149+
case DATA:
150+
GPIO_SetValue(LCD_CNTRL,RS); /* Select Data register */
151+
break;
152+
}
153+
GPIO_SetDir(LCD_PORT,LCD_DATA,0); /*Set P2.0 to P2.7 as input pins */
154+
GPIO_ClearValue(LCD_CNTRL,LCD_DIR); /* Set Buffer Direction to RD */
155+
GPIO_ClearValue(LCD_CNTRL,LCD_EN); /* Enable MSB buffer outputs */
156+
GPIO_ClearValue(LCD_CNTRL,CS); /* Select Device */
157+
158+
GPIO_ClearValue(LCD_CNTRL,RD); /* Start reading data */
159+
GPIO_SetValue(LCD_CNTRL,WR);
160+
PORT_VAL = GPIO_ReadValue(LCD_PORT); /*Read PORT2 MSB value */
161+
MSB = (unsigned short)PORT_VAL&LCD_DATA;
162+
GPIO_SetValue(LCD_CNTRL,LCD_EN); /* Enable buffer outputs */
163+
PORT_VAL = GPIO_ReadValue(LCD_PORT); /*Read PORT2 LSB value */
164+
LSB = (unsigned short)PORT_VAL&LCD_DATA;
165+
GPIO_SetValue(LCD_CNTRL,RD); /* Stop reading */
166+
GPIO_SetValue(LCD_CNTRL,CS); /* de-select device */
167+
dat = (MSB<<8)|LSB;
168+
return dat;
169+
}
170+
171+
#endif
172+
173+
void write_reg(unsigned char reg,unsigned short dat)
174+
{
175+
write_LCD((unsigned short)reg,CMD);
176+
write_LCD(dat,DATA);
177+
}
178+
179+
unsigned short read_reg(unsigned char reg)
180+
{
181+
return read_LCD((unsigned short)reg,CMD);
182+
}
183+
184+
void LCD_SetCursor(unsigned short hor,unsigned short ver)
185+
{
186+
if(hor > 0x00F0) {
187+
hor = 0;
188+
ver = ver+1;
189+
}
190+
if(ver > 0x0140) {
191+
ver = ver%0x0140;
192+
}
193+
write_reg(R4E, hor);
194+
write_reg(R4F, ver);
195+
info.curr_y = ver;
196+
info.curr_x = hor;
197+
}
198+
199+
void LCD_Clear(unsigned short colour)
200+
{
201+
unsigned long i;
202+
203+
i = 0x00F0 * 0X0140;
204+
write_reg(R44, 0 | (239 << 8));
205+
write_reg(R45, 0);
206+
write_reg(R46, 319);
207+
write_reg(R4E, 0);
208+
write_reg(R4F, 0);
209+
210+
/*
211+
* Write to GRAM
212+
*/
213+
write_LCD(R22,CMD);
214+
while(i--)
215+
{
216+
write_LCD(colour,DATA);
217+
}
218+
info.background = colour;
219+
info.foreground = colour;
220+
}
221+
222+
void LCD_SetWindow(unsigned short xBeg, unsigned short yBeg, unsigned short xEnd, unsigned short yEnd)
223+
{
224+
write_reg(R44, xBeg | ((xEnd) << 8));
225+
write_reg(R45, yBeg);
226+
write_reg(R46, yEnd);
227+
}
228+
229+
/*
230+
* This function draws a dot of colour - 'colour'
231+
*/
232+
void LCD_DrawDot(unsigned short x,unsigned short y)
233+
{
234+
LCD_SetCursor(x,y);
235+
write_reg(R22,info.foreground);
236+
}
237+
238+
void LCD_DrawLine(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2)
239+
{
240+
unsigned short i;
241+
short sIncX, sIncY, sDeltaX, sDeltaY;
242+
unsigned short usXerr = 0, usYerr = 0, usRow, usCol, usDistance;
243+
244+
sDeltaX = x2 - x1;
245+
sDeltaY = y2 - y1;
246+
usRow = x1;
247+
usCol = y1;
248+
if(sDeltaX > 0)
249+
{
250+
sIncX = 1;
251+
}
252+
else if(sDeltaX == 0)
253+
{
254+
sIncX = 0;
255+
}
256+
else
257+
{
258+
sIncX = -1;
259+
sDeltaX = -sDeltaX;
260+
}
261+
262+
if(sDeltaY > 0)
263+
{
264+
sIncY = 1;
265+
}
266+
else if(sDeltaY == 0)
267+
{
268+
sIncY = 0;
269+
}
270+
else
271+
{
272+
sIncY = -1;
273+
sDeltaY = -sDeltaY;
274+
}
275+
276+
if(sDeltaX > sDeltaY)
277+
{
278+
usDistance = sDeltaX;
279+
}
280+
else
281+
{
282+
usDistance = sDeltaY;
283+
}
284+
285+
for(i = 0; i <= usDistance + 1; i++ )
286+
{
287+
LCD_DrawDot(usRow, usCol);
288+
usXerr += sDeltaX;
289+
usYerr += sDeltaY ;
290+
if(usXerr > usDistance)
291+
{
292+
usXerr -= usDistance;
293+
usRow += sIncX;
294+
}
295+
if(usYerr > usDistance)
296+
{
297+
usYerr -= usDistance;
298+
usCol += sIncY;
299+
}
300+
}
301+
}
302+
303+
void LCD_init()
304+
{
305+
unsigned short ID;
306+
GPIO_SetDir(LCD_CNTRL,CS|RS|WR|RD|LCD_DIR|LCD_EN|LCD_LE,1); /* Set CS,RS,WR,RD pins as output for uC */
307+
308+
ID = read_reg(0x0000); //Read device ID -- 0x8989 for SSD1289
309+
if(ID == 0x8989)
310+
{
311+
//------------- Start Initial Sequence -------------//
312+
write_reg(R00, 0x0001); // Start internal OSC.
313+
write_reg(R01, 0x3B3F); // Driver output control, RL=0;REV=1;GD=1;BGR=0;SM=0;TB=1
314+
write_reg(R02, 0x0600); // set 1 line inversion
315+
//------------- Power control setup ----------------//
316+
write_reg(R0C, 0x0007); // Adjust VCIX2 output voltage
317+
write_reg(R0D, 0x0006); // Set amplitude magnification of VLCD63
318+
write_reg(R0E, 0x3200); // Set alternating amplitude of VCOM
319+
write_reg(0x1E, 0x00BB); // Set VcomH voltage
320+
write_reg(0x03, 0x6A64); // Step-up factor/cycle setting
321+
//------------- RAM position control ---------------//
322+
write_reg(R0F, 0x0000); // Gate scan position start at G0.
323+
write_reg(R44, 0xEF00); // Horizontal RAM address position
324+
write_reg(R45, 0x0000); // Vertical RAM address start position
325+
write_reg(R46, 0x013F); // Vertical RAM address end position
326+
// ----------- Adjust the Gamma Curve ----------//
327+
write_reg(R30, 0x0000);
328+
write_reg(R31, 0x0706);
329+
write_reg(R32, 0x0206);
330+
write_reg(R33, 0x0300);
331+
write_reg(R34, 0x0002);
332+
write_reg(R35, 0x0000);
333+
write_reg(R36, 0x0707);
334+
write_reg(R37, 0x0200);
335+
write_reg(R3A, 0x0908);
336+
write_reg(R3B, 0x0F0D);
337+
//----------------- Set VCOM OTP ---------------//
338+
write_reg(R28, 0x0006);
339+
//---------------- Turn On display -------------//
340+
write_reg(R10, 0x0000); // Sleep mode off.
341+
LCD_delay_ms(50); // Wait 50mS
342+
write_reg(R11, 0x6070); // Entry mode setup. 262K type B,16-bit data bus only
343+
write_reg(R07, 0x0033); // Display ON
344+
345+
LCD_delay_ms(100);
346+
347+
LCD_Clear(BLACK);
348+
info.foreground = WHITE;
349+
350+
}
351+
}
352+
353+
void LCD_DrawCircle(unsigned short x, unsigned short y, unsigned short r)
354+
{
355+
unsigned short a, b;
356+
short di;
357+
358+
a = 0;
359+
b = r;
360+
di = 3 - (r << 1);
361+
while(a <= b)
362+
{
363+
LCD_DrawDot(x + b, y - a);
364+
LCD_DrawDot(x - a, y + b);
365+
LCD_DrawDot(x - b, y - a);
366+
LCD_DrawDot(x - a, y - b);
367+
LCD_DrawDot(x + b, y + a);
368+
LCD_DrawDot(x + a, y - b);
369+
LCD_DrawDot(x + a, y + b);
370+
LCD_DrawDot(x - b, y + a);
371+
a++;
372+
if(di < 0)
373+
di += 4 * a + 6;
374+
else
375+
{
376+
di += 10 + 4 * (a - b);
377+
b--;
378+
}
379+
LCD_DrawDot(x + a, y + b);
380+
}
381+
}
382+
383+
void LCD_PutChar(unsigned char ucChar)
384+
{
385+
386+
unsigned char ucTemp, ucRow, t;
387+
388+
LCD_SetWindow(info.curr_x, info.curr_y, info.curr_x + info.font_size/2 - 1, info.curr_y + info.font_size - 1);
389+
LCD_SetCursor(info.curr_x, info.curr_y);
390+
391+
write_LCD(R22,CMD);
392+
393+
for(ucRow = 0; ucRow < info.font_size; ucRow++)
394+
{
395+
if(info.font_size== 12)
396+
ucTemp = ASCII_1206[ucChar][ucRow];
397+
else
398+
ucTemp = ASCII_1608[ucChar][ucRow];
399+
for(t = 0; t < info.font_size / 2; t++)
400+
{
401+
if(ucTemp & 0x01)
402+
write_LCD(info.foreground,DATA);
403+
else
404+
write_LCD(info.background,DATA);
405+
ucTemp >>= 1;
406+
}
407+
}
408+
}
409+
410+
void LCD_DisplayOn(void)
411+
{
412+
write_reg(R07,0x0033);
413+
}
414+
415+
void LCD_DisplayOff(void)
416+
{
417+
write_reg(R07,0x0000);
418+
}
419+
420+
void LCD_PutString(char *str,char f_size,unsigned int colour)
421+
{
422+
int i=0;
423+
info.foreground = colour;
424+
if(f_size == 16)
425+
info.font_size = f_size;
426+
else
427+
info.font_size = 12;
428+
while(str[i]!='\0') {
429+
if(str[i] == '\n') {
430+
info.curr_x = 0;
431+
info.curr_y+= info.font_size + 1;
432+
i++;
433+
continue;
434+
}
435+
if(str[i] == '\t') {
436+
info.curr_x+=4*(info.font_size/2);
437+
if((info.curr_x + (info.font_size/2)) > 0x00F0) {
438+
info.curr_x-= 0x00F0;
439+
info.curr_y+= info.font_size + 1;
440+
}
441+
i++;
442+
continue;
443+
}
444+
LCD_PutChar((char)(str[i]-32));
445+
info.curr_x+= info.font_size/2;
446+
/* Fold to next line */
447+
if((info.curr_x+(info.font_size/2)) > 0x00F0) {
448+
info.curr_x = 0;
449+
info.curr_y+= info.font_size + 1;
450+
}
451+
i++;
452+
}
453+
}
454+

‎SSD1289.h

+203
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
#include "colors.h"
2+
#include "lpc17xx_clkpwr.h"
3+
#include "lpc17xx_nvic.h"
4+
#include "lpc17xx_gpio.h"
5+
#include "FONT.H"
6+
7+
8+
/* SELECT BOARD */
9+
#define LAND_TIGERV2
10+
//#define OTHER
11+
12+
/*
13+
* GLCD registers
14+
*/
15+
#define R00 0x00
16+
#define R01 0x01
17+
#define R02 0x02
18+
#define R03 0x03
19+
#define R04 0x04
20+
#define R05 0X05
21+
#define R06 0x06
22+
#define R07 0x07
23+
#define R08 0x08
24+
#define R09 0x09
25+
#define R0A 0x0A
26+
#define R0B 0x0B
27+
#define R0C 0x0C
28+
#define R0D 0x0D
29+
#define R0E 0x0E
30+
#define R0F 0x0F
31+
#define R10 0x10
32+
#define R11 0x11
33+
#define R12 0x12
34+
#define R22 0x22
35+
#define R28 0x28
36+
#define R30 0x30
37+
#define R31 0x31
38+
#define R32 0x32
39+
#define R33 0x33
40+
#define R34 0x34
41+
#define R35 0x35
42+
#define R36 0x36
43+
#define R37 0x37
44+
#define R38 0x38
45+
#define R39 0x39
46+
#define R3A 0x3A
47+
#define R3B 0x3B
48+
#define R44 0x44
49+
#define R45 0x45
50+
#define R46 0x46
51+
#define R4E 0x4E
52+
#define R4F 0x4F
53+
54+
/*
55+
* HARDWARE PINS AND OTHER DEFS
56+
*/
57+
#define TIMER0 0
58+
#define CMD '0'
59+
#define DATA '1'
60+
#define PORT0 0
61+
#define PORT1 1
62+
#define PORT2 2
63+
#define PORT3 3
64+
#define PORT4 4
65+
66+
#define LCD_DATA 0xFF /* PORT 2 */
67+
#define LCD_DIR (1<<21) /* PORT 0 */
68+
#define LCD_EN (1<<19) /* PORT 0 */
69+
#define LCD_LE (1<<20) /* PORT 0 */
70+
#define CS (1<<22) /* PORT 0 */
71+
#define RS (1<<23) /* PORT 0 */
72+
#define WR (1<<24) /* PORT 0 */
73+
#define RD (1<<25) /* PORT 0 */
74+
75+
/*
76+
* Select board or define LCD_PORT connections as per your board(OTHER)
77+
*/
78+
#ifdef LAND_TIGERV2
79+
#define LCD_PORT PORT2
80+
#define LCD_CNTRL PORT0
81+
#else
82+
#ifdef OTHER
83+
#define LCD_PORT
84+
#define LCD_CNTRL
85+
#endif
86+
#endif
87+
88+
struct LCD {
89+
unsigned short curr_x, curr_y, foreground, background;
90+
char font_size;
91+
}info;
92+
93+
94+
95+
char str[12];
96+
char *num2str(int num);
97+
98+
99+
/*
100+
* Draw a rectangular box through size (arg1,arg2) to (arg3,arg4)
101+
* arg5 - Colour of box
102+
* First co-ordinate set is of the bottom left corner of the box
103+
*/
104+
void LCD_DrawRectangle(unsigned short,unsigned short,unsigned short,unsigned short,unsigned int);
105+
106+
/*
107+
* Write data to GPIO
108+
*/
109+
void GPIO_WriteData(int port,unsigned short data);
110+
111+
112+
113+
/*
114+
* Write data to LCD
115+
* Arg1 - Data
116+
* Arg2 - CMD/DATA (depending on whether it's data to GRAM or an instruction)
117+
*/
118+
void write_LCD(unsigned short,char);
119+
120+
/*
121+
* read data from LCD
122+
* arg1 - register address(refer to SSD1289 datasheet)
123+
* arg2 - command or data register
124+
*/
125+
unsigned short read_LCD(unsigned char,unsigned char);
126+
127+
/*
128+
* Directly write to register
129+
* arg1 - register
130+
* arg2 - data
131+
*/
132+
void write_reg(unsigned char,unsigned short);
133+
134+
/*
135+
* Read data from LCD register
136+
* arg - register address
137+
*/
138+
unsigned short read_reg(unsigned char);
139+
140+
/*
141+
* Set cursor to a particular pixel on LCD
142+
* arg1 - x coordinate
143+
* arg2 - y coordinate
144+
*/
145+
void LCD_SetCursor(unsigned short,unsigned short);
146+
147+
/*
148+
* Clear LCD with specified colour
149+
* arg - colour
150+
*/
151+
void LCD_Clear(unsigned short colour);
152+
153+
/*
154+
* Set window of specified area
155+
* arg1,arg2 - x,y coordinates of start
156+
* arg3,arg4 - x,y coordinates of end
157+
*/
158+
void LCD_SetWindow(unsigned short, unsigned short, unsigned short , unsigned short);
159+
160+
/*
161+
* Draw a single dot at arg1,arg2 position
162+
*/
163+
164+
void LCD_DrawDot(unsigned short ,unsigned short );
165+
166+
/*
167+
* Draw a straight line from (arg1,arg2) to (arg3,arg4)
168+
*/
169+
170+
void LCD_DrawLine(unsigned short, unsigned short, unsigned short, unsigned short);
171+
172+
/*
173+
* Initialize LCD
174+
*/
175+
void LCD_init();
176+
177+
/*
178+
* Draw circle with center at (arg1,arg2) and radius arg3
179+
*/
180+
void LCD_DrawCircle(unsigned short, unsigned short, unsigned short);
181+
182+
/*
183+
* Display on
184+
*/
185+
void LCD_DisplayOn(void);
186+
187+
/*
188+
* Display off
189+
*/
190+
void LCD_DisplayOff(void);
191+
192+
/*
193+
* Write a single character on screen at current x,y position
194+
*/
195+
void LCD_PutChar(unsigned char);
196+
197+
/*
198+
* Write a string of colour arg3, size arg2
199+
* arg1 specifies string
200+
*/
201+
void LCD_PutString(char *,char,unsigned int);
202+
203+

‎colors.h

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//*****************************************************************************
2+
//
3+
//! \file colors.h
4+
//! \brief Frequence used colors defined in this file.
5+
//! \version 2.1.1.0
6+
//! \date 12/20/2012
7+
//! \author CooCoX
8+
//! \copy
9+
//!
10+
//! Copyright (c) 2011, CooCoX
11+
//! All rights reserved.
12+
//!
13+
//! Redistribution and use in source and binary forms, with or without
14+
//! modification, are permitted provided that the following conditions
15+
//! are met:
16+
//!
17+
//! * Redistributions of source code must retain the above copyright
18+
//! notice, this list of conditions and the following disclaimer.
19+
//! * Redistributions in binary form must reproduce the above copyright
20+
//! notice, this list of conditions and the following disclaimer in the
21+
//! documentation and/or other materials provided with the distribution.
22+
//! * Neither the name of the <ORGANIZATION> nor the names of its
23+
//! contributors may be used to endorse or promote products derived
24+
//! from this software without specific prior written permission.
25+
//!
26+
//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27+
//! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28+
//! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29+
//! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30+
//! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31+
//! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32+
//! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33+
//! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34+
//! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35+
//! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
36+
//! THE POSSIBILITY OF SUCH DAMAGE.
37+
//
38+
//*****************************************************************************
39+
#ifndef __COLORS_H__
40+
#define __COLORS_H__
41+
42+
#define WHITE 0xFFFF
43+
#define BLACK 0x0000
44+
#define BLUE 0x001F
45+
#define BRED 0XF81F
46+
#define GRED 0XFFE0
47+
#define GBLUE 0X07FF
48+
#define RED 0xF800
49+
#define MAGENTA 0xF81F
50+
#define GREEN 0x07E0
51+
#define CYAN 0x7FFF
52+
#define YELLOW 0xFFE0
53+
#define BROWN 0XBC40
54+
#define BRRED 0XFC07
55+
#define GRAY 0X8430
56+
57+
#define DARKBLUE 0X01CF
58+
#define LIGHTBLUE 0X7D7C
59+
#define GRAYBLUE 0X5458
60+
61+
#define LIGHTGREEN 0X841F
62+
#define LIGHTGRAY 0XEF5B
63+
#define LGRAY 0XC618
64+
#define LGRAYBLUE 0XA651
65+
#define LBBLUE 0X2B12
66+
67+
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.