Line No. | Rev | Author | Line |
---|---|---|---|
1 | 6 | kaklik | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
2 | <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> |
||
3 | <title>Procyon AVRlib: ks0108.h Source File</title> |
||
4 | <link href="dox.css" rel="stylesheet" type="text/css"> |
||
5 | </head><body> |
||
6 | <!-- Generated by Doxygen 1.4.2 --> |
||
7 | <div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div> |
||
8 | <h1>ks0108.h</h1><a href="ks0108_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file ks0108.h \brief Graphic LCD driver for HD61202/KS0108 displays. */</span> |
||
9 | 00002 <span class="comment">//*****************************************************************************</span> |
||
10 | 00003 <span class="comment">//</span> |
||
11 | 00004 <span class="comment">// File Name : 'ks0108.h'</span> |
||
12 | 00005 <span class="comment">// Title : Graphic LCD driver for HD61202/KS0108 displays</span> |
||
13 | 00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2001-2003</span> |
||
14 | 00007 <span class="comment">// Date : 10/19/2002</span> |
||
15 | 00008 <span class="comment">// Revised : 5/1/2003</span> |
||
16 | 00009 <span class="comment">// Version : 0.5</span> |
||
17 | 00010 <span class="comment">// Target MCU : Atmel AVR</span> |
||
18 | 00011 <span class="comment">// Editor Tabs : 4</span> |
||
19 | 00012 <span class="comment">//</span> |
||
20 | 00013 <span class="comment">// NOTE: This code is currently below version 1.0, and therefore is considered</span> |
||
21 | 00014 <span class="comment">// to be lacking in some functionality or documentation, or may not be fully</span> |
||
22 | 00015 <span class="comment">// tested. Nonetheless, you can expect most functions to work.</span> |
||
23 | 00016 <span class="comment">//</span><span class="comment"></span> |
||
24 | 00017 <span class="comment">/// \ingroup driver_hw</span> |
||
25 | 00018 <span class="comment">/// \defgroup ks0108 Graphic LCD Driver for HD61202/KS0108-based Displays (ks0108.c)</span> |
||
26 | 00019 <span class="comment">/// \code #include "ks0108.h" \endcode</span> |
||
27 | 00020 <span class="comment">/// \par Overview</span> |
||
28 | 00021 <span class="comment">/// This display driver performs the basic functions necessary to access</span> |
||
29 | 00022 <span class="comment">/// any graphic LCD based on the KS0108 or HD61202 controller chip. For more</span> |
||
30 | 00023 <span class="comment">/// advanced functions, use this driver in conjunction with glcd.c.</span> |
||
31 | 00024 <span class="comment">/// KS0108/HD61202 displays typically range in size from 64x32 pixels to</span> |
||
32 | 00025 <span class="comment">/// 128x128 pixels and up to 3" square. To determine whether a display is</span> |
||
33 | 00026 <span class="comment">/// compatible, you should look for the above controller chips to be mounted</span> |
||
34 | 00027 <span class="comment">/// on the PC board attached to the display glass. The controller chips are</span> |
||
35 | 00028 <span class="comment">/// about 1/2" x 3/4" and have 80+ pins. On larger displays, you may also see</span> |
||
36 | 00029 <span class="comment">/// slave LCD driver chips with the numbers KS0107 or HD61203. The display</span> |
||
37 | 00030 <span class="comment">/// will likely have an 18 or 20-pin interface. The interface from the LCD</span> |
||
38 | 00031 <span class="comment">/// to an AVR processor does not require any additional hardware. If you can</span> |
||
39 | 00032 <span class="comment">/// locate a datasheet for your display, that plus the information in the</span> |
||
40 | 00033 <span class="comment">/// ks0108conf.h file should be all you need to get hooked up.</span> |
||
41 | 00034 <span class="comment"></span><span class="comment">//</span> |
||
42 | 00035 <span class="comment">// This code is distributed under the GNU Public License</span> |
||
43 | 00036 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span> |
||
44 | 00037 <span class="comment">//</span> |
||
45 | 00038 <span class="comment">//*****************************************************************************</span> |
||
46 | 00039 |
||
47 | 00040 |
||
48 | 00041 <span class="preprocessor">#ifndef KS0108_H</span> |
||
49 | 00042 <span class="preprocessor"></span><span class="preprocessor">#define KS0108_H</span> |
||
50 | 00043 <span class="preprocessor"></span> |
||
51 | 00044 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span> |
||
52 | 00045 |
||
53 | 00046 <span class="preprocessor">#include "<a class="code" href="ks0108conf_8h.html">ks0108conf.h</a>"</span> |
||
54 | 00047 |
||
55 | 00048 <span class="comment">// HD61202/KS0108 command set</span> |
||
56 | 00049 <span class="preprocessor">#define GLCD_ON_CTRL 0x3E // 0011111X: lcd on/off control</span> |
||
57 | 00050 <span class="preprocessor"></span><span class="preprocessor">#define GLCD_ON_DISPLAY 0x01 // DB0: turn display on</span> |
||
58 | 00051 <span class="preprocessor"></span> |
||
59 | 00052 <span class="preprocessor">#define GLCD_START_LINE 0xC0 // 11XXXXXX: set lcd start line</span> |
||
60 | 00053 <span class="preprocessor"></span> |
||
61 | 00054 <span class="preprocessor">#define GLCD_SET_PAGE 0xB8 // 10111XXX: set lcd page (X) address</span> |
||
62 | 00055 <span class="preprocessor"></span><span class="preprocessor">#define GLCD_SET_Y_ADDR 0x40 // 01YYYYYY: set lcd Y address</span> |
||
63 | 00056 <span class="preprocessor"></span> |
||
64 | 00057 <span class="preprocessor">#define GLCD_STATUS_BUSY 0x80 // (1)->LCD IS BUSY</span> |
||
65 | 00058 <span class="preprocessor"></span><span class="preprocessor">#define GLCD_STATUS_ONOFF 0x20 // (0)->LCD IS ON</span> |
||
66 | 00059 <span class="preprocessor"></span><span class="preprocessor">#define GLCD_STATUS_RESET 0x10 // (1)->LCD IS RESET</span> |
||
67 | 00060 <span class="preprocessor"></span> |
||
68 | 00061 <span class="comment">// determine the number of controllers</span> |
||
69 | 00062 <span class="comment">// (make sure we round up for partial use of more than one controller)</span> |
||
70 | 00063 <span class="preprocessor">#define GLCD_NUM_CONTROLLERS ((GLCD_XPIXELS+GLCD_CONTROLLER_XPIXELS-1)/GLCD_CONTROLLER_XPIXELS)</span> |
||
71 | 00064 <span class="preprocessor"></span> |
||
72 | 00065 <span class="comment">// typedefs/structures</span> |
||
73 | 00066 <span class="keyword">typedef</span> <span class="keyword">struct </span>struct_GrLcdCtrlrStateType |
||
74 | 00067 { |
||
75 | 00068 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> xAddr; |
||
76 | 00069 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> yAddr; |
||
77 | 00070 } GrLcdCtrlrStateType; |
||
78 | 00071 |
||
79 | 00072 <span class="keyword">typedef</span> <span class="keyword">struct </span>struct_GrLcdStateType |
||
80 | 00073 { |
||
81 | 00074 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> lcdXAddr; |
||
82 | 00075 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> lcdYAddr; |
||
83 | 00076 GrLcdCtrlrStateType ctrlr[GLCD_NUM_CONTROLLERS]; |
||
84 | 00077 } GrLcdStateType; |
||
85 | 00078 |
||
86 | 00079 <span class="comment">// function prototypes</span> |
||
87 | 00080 <span class="keywordtype">void</span> glcdInitHW(<span class="keywordtype">void</span>); |
||
88 | 00081 <span class="keywordtype">void</span> glcdBusyWait(u08 controller); |
||
89 | 00082 <span class="keywordtype">void</span> glcdControlWrite(u08 controller, u08 data); |
||
90 | 00083 u08 glcdControlRead(u08 controller); |
||
91 | 00084 <span class="keywordtype">void</span> glcdDataWrite(u08 data); |
||
92 | 00085 u08 glcdDataRead(<span class="keywordtype">void</span>); |
||
93 | 00086 <span class="keywordtype">void</span> glcdSetXAddress(u08 xAddr); |
||
94 | 00087 <span class="keywordtype">void</span> glcdSetYAddress(u08 yAddr); |
||
95 | 00088 |
||
96 | 00089 <span class="comment"></span> |
||
97 | 00090 <span class="comment">//! Initialize the display, clear it, and prepare it for access</span> |
||
98 | 00091 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ks0108_8c.html#a11">glcdInit</a>(<span class="keywordtype">void</span>);<span class="comment"></span> |
||
99 | 00092 <span class="comment">//! Clear the display</span> |
||
100 | 00093 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ks0108_8c.html#a13">glcdClearScreen</a>(<span class="keywordtype">void</span>);<span class="comment"></span> |
||
101 | 00094 <span class="comment">//! Set display memory access point back to upper,left corner</span> |
||
102 | 00095 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ks0108_8c.html#a12">glcdHome</a>(<span class="keywordtype">void</span>);<span class="comment"></span> |
||
103 | 00096 <span class="comment">//! Set display memory access point to row [line] and column [col] assuming 5x7 font</span> |
||
104 | 00097 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ks0108_8c.html#a16">glcdGotoChar</a>(u08 line, u08 col);<span class="comment"></span> |
||
105 | 00098 <span class="comment">//! Set display memory access point to [x] horizontal pixel and [y] vertical line</span> |
||
106 | 00099 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ks0108_8c.html#a15">glcdSetAddress</a>(u08 x, u08 yLine);<span class="comment"></span> |
||
107 | 00100 <span class="comment">//! Set display memory access point to row [line] and column [col] assuming 5x7 font</span> |
||
108 | 00101 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ks0108_8c.html#a14">glcdStartLine</a>(u08 start);<span class="comment"></span> |
||
109 | 00102 <span class="comment">//! Generic delay routine for timed glcd access</span> |
||
110 | 00103 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ks0108_8c.html#a17">glcdDelay</a>(u16 p); |
||
111 | 00104 <span class="preprocessor">#endif</span> |
||
112 | </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:07 2006 for Procyon AVRlib by |
||
113 | <a href="http://www.doxygen.org/index.html"> |
||
114 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address> |
||
115 | </body> |
||
116 | </html> |
Powered by WebSVN v2.8.3