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: Spyglass Control Panel UI Board Driver (spyglass.c)</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>Spyglass Control Panel UI Board Driver (spyglass.c)<br> |
||
9 | <small> |
||
10 | [<a class="el" href="group__driver__hw.html">Drivers (for external hardware)</a>]</small> |
||
11 | </h1><hr><a name="_details"></a><h2>Detailed Description</h2> |
||
12 | <div class="fragment"><pre class="fragment"><span class="preprocessor"> #include "<a class="code" href="lcd_8h.html">lcd.h</a>"</span> |
||
13 | <span class="preprocessor"> #include "<a class="code" href="i2c_8h.html">i2c.h</a>"</span> |
||
14 | <span class="preprocessor"> #include "<a class="code" href="spyglass_8h.html">spyglass.h</a>"</span> |
||
15 | </pre></div> <dl compact><dt><b>Overview</b></dt><dd>This library supports the 'Spyglass' I2C-controlled User Interface board. The Spyglass board has a standard 4x20 character LCD and a convenient array of pushbuttons for a user interface. The board also has a user-controllable piezo beeper. All of these functions are accessible via I2C bus, making it possible to have a complete user interface with just 4 wires (2 I/O and 2 power wires). The Spyglass board runs on 5V power.</dd></dl> |
||
16 | <dl compact><dt><b>Connections:</b></dt><dd><ul> |
||
17 | <li>Connect power to the +5V and ground pins.</li><li>Connect the SCL/SDA pins to the corresponding SCL/SDA pins of your processor's I2C bus.</li><li>If you wish to use the beeper, also connect +5V to pin 8.</li></ul> |
||
18 | </dd></dl> |
||
19 | <div class="fragment"><pre class="fragment"> SPYGLASS PINOUT <span class="keywordflow">for</span> 10-pin I/O header: |
||
20 | |||
21 | ---- |
||
22 | +5V - 1 |++| 2 - +5V |
||
23 | SCL - 3 |++| 4 - GND |
||
24 | SDA - 5 |++| 6 - GND |
||
25 | 7 |++| 8 - BEEPER PWR (+5V) |
||
26 | 9 |++| 10 |
||
27 | ---- |
||
28 | </pre></div> |
||
29 | <p> |
||
30 | <table border="0" cellpadding="0" cellspacing="0"> |
||
31 | <tr><td></td></tr> |
||
32 | <tr><td colspan="2"><br><h2>Defines</h2></td></tr> |
||
33 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga13" doxytag="spyglass::PCF8574_I2C_BASE_ADDR"></a> |
||
34 | #define </td><td class="memItemRight" valign="bottom"><b>PCF8574_I2C_BASE_ADDR</b> 0x40</td></tr> |
||
35 | |||
36 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga14" doxytag="spyglass::MAX517_I2C_BASE_ADDR"></a> |
||
37 | #define </td><td class="memItemRight" valign="bottom"><b>MAX517_I2C_BASE_ADDR</b> 0x58</td></tr> |
||
38 | |||
39 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga15" doxytag="spyglass::PCF_NODE_BUTTONS"></a> |
||
40 | #define </td><td class="memItemRight" valign="bottom"><b>PCF_NODE_BUTTONS</b> 0x00</td></tr> |
||
41 | |||
42 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga16" doxytag="spyglass::PCF_NODE_LCD_DATA"></a> |
||
43 | #define </td><td class="memItemRight" valign="bottom"><b>PCF_NODE_LCD_DATA</b> 0x01</td></tr> |
||
44 | |||
45 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga17" doxytag="spyglass::PCF_NODE_CONTROL"></a> |
||
46 | #define </td><td class="memItemRight" valign="bottom"><b>PCF_NODE_CONTROL</b> 0x02</td></tr> |
||
47 | |||
48 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga18" doxytag="spyglass::SPYGLASS_LED0"></a> |
||
49 | #define </td><td class="memItemRight" valign="bottom"><b>SPYGLASS_LED0</b> 0x01</td></tr> |
||
50 | |||
51 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga19" doxytag="spyglass::SPYGLASS_LED1"></a> |
||
52 | #define </td><td class="memItemRight" valign="bottom"><b>SPYGLASS_LED1</b> 0x02</td></tr> |
||
53 | |||
54 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga20" doxytag="spyglass::SPYGLASS_BEEPER"></a> |
||
55 | #define </td><td class="memItemRight" valign="bottom"><b>SPYGLASS_BEEPER</b> 0x04</td></tr> |
||
56 | |||
57 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga21" doxytag="spyglass::SPYGLASS_LCD_RS"></a> |
||
58 | #define </td><td class="memItemRight" valign="bottom"><b>SPYGLASS_LCD_RS</b> 0x20</td></tr> |
||
59 | |||
60 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga22" doxytag="spyglass::SPYGLASS_LCD_RW"></a> |
||
61 | #define </td><td class="memItemRight" valign="bottom"><b>SPYGLASS_LCD_RW</b> 0x40</td></tr> |
||
62 | |||
63 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga23" doxytag="spyglass::SPYGLASS_LCD_E"></a> |
||
64 | #define </td><td class="memItemRight" valign="bottom"><b>SPYGLASS_LCD_E</b> 0x80</td></tr> |
||
65 | |||
66 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga24" doxytag="spyglass::lcdInit"></a> |
||
67 | #define </td><td class="memItemRight" valign="bottom"><b>lcdInit</b> spyglassLcdInit</td></tr> |
||
68 | |||
69 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga25" doxytag="spyglass::lcdHome"></a> |
||
70 | #define </td><td class="memItemRight" valign="bottom"><b>lcdHome</b> spyglassLcdHome</td></tr> |
||
71 | |||
72 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga26" doxytag="spyglass::lcdClear"></a> |
||
73 | #define </td><td class="memItemRight" valign="bottom"><b>lcdClear</b> spyglassLcdClear</td></tr> |
||
74 | |||
75 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga27" doxytag="spyglass::lcdGotoXY"></a> |
||
76 | #define </td><td class="memItemRight" valign="bottom"><b>lcdGotoXY</b> spyglassLcdGotoXY</td></tr> |
||
77 | |||
78 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga28" doxytag="spyglass::lcdDataWrite"></a> |
||
79 | #define </td><td class="memItemRight" valign="bottom"><b>lcdDataWrite</b> spyglassLcdWriteChar</td></tr> |
||
80 | |||
81 | <tr><td colspan="2"><br><h2>Functions</h2></td></tr> |
||
82 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga0" doxytag="spyglass::spyglassInit"></a> |
||
83 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spyglass.html#ga0">spyglassInit</a> (void)</td></tr> |
||
84 | |||
85 | <tr><td class="mdescLeft"> </td><td class="mdescRight">initialize the I2C bus for communication with the spyglass UI. <br></td></tr> |
||
86 | <tr><td class="memItemLeft" nowrap align="right" valign="top">u08 </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spyglass.html#ga1">spyglassGetPushbuttons</a> (void)</td></tr> |
||
87 | |||
88 | <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spyglass.html#ga2">spyglassSetLeds</a> (u08 leds)</td></tr> |
||
89 | |||
90 | <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spyglass.html#ga3">spyglassSetBeeper</a> (u08 state)</td></tr> |
||
91 | |||
92 | <tr><td class="memItemLeft" nowrap align="right" valign="top">u08 </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spyglass.html#ga4">spyglassSetLcdContrast</a> (u08 contrast)</td></tr> |
||
93 | |||
94 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga5" doxytag="spyglass::spyglassLcdInit"></a> |
||
95 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spyglass.html#ga5">spyglassLcdInit</a> (void)</td></tr> |
||
96 | |||
97 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Initialize LCD for operation. <br></td></tr> |
||
98 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga6" doxytag="spyglass::spyglassLcdHome"></a> |
||
99 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spyglass.html#ga6">spyglassLcdHome</a> (void)</td></tr> |
||
100 | |||
101 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Set write/cursor position to upper left. <br></td></tr> |
||
102 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga7" doxytag="spyglass::spyglassLcdClear"></a> |
||
103 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spyglass.html#ga7">spyglassLcdClear</a> (void)</td></tr> |
||
104 | |||
105 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Clear LCD display. <br></td></tr> |
||
106 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga8" doxytag="spyglass::spyglassLcdGotoXY"></a> |
||
107 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spyglass.html#ga8">spyglassLcdGotoXY</a> (u08 x, u08 y)</td></tr> |
||
108 | |||
109 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Set write/cursor posision on LCD display (x=col, y=line). <br></td></tr> |
||
110 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga9" doxytag="spyglass::spyglassLcdWrite"></a> |
||
111 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spyglass.html#ga9">spyglassLcdWrite</a> (u08 rs, u08 data)</td></tr> |
||
112 | |||
113 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Write control or display data to LCD. <br></td></tr> |
||
114 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga10" doxytag="spyglass::spyglassLcdWriteChar"></a> |
||
115 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spyglass.html#ga10">spyglassLcdWriteChar</a> (u08 c)</td></tr> |
||
116 | |||
117 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Write character to LCD. <br></td></tr> |
||
118 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga11" doxytag="spyglass::pcf8574Write"></a> |
||
119 | u08 </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spyglass.html#ga11">pcf8574Write</a> (u08 nodeAddr, u08 data)</td></tr> |
||
120 | |||
121 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Write I/O Data to PCF8574 I2C<->Digital I/O chip. <br></td></tr> |
||
122 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga12" doxytag="spyglass::pcf8574Read"></a> |
||
123 | u08 </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spyglass.html#ga12">pcf8574Read</a> (u08 nodeAddr)</td></tr> |
||
124 | |||
125 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Read I/O Data from PCF8574 I2C<->Digital I/O chip. <br></td></tr> |
||
126 | </table> |
||
127 | <hr><h2>Function Documentation</h2> |
||
128 | <a class="anchor" name="ga1" doxytag="spyglass.h::spyglassGetPushbuttons"></a><p> |
||
129 | <table class="mdTable" cellpadding="2" cellspacing="0"> |
||
130 | <tr> |
||
131 | <td class="mdRow"> |
||
132 | <table cellpadding="0" cellspacing="0" border="0"> |
||
133 | <tr> |
||
134 | <td class="md" nowrap valign="top">u08 spyglassGetPushbuttons </td> |
||
135 | <td class="md" valign="top">( </td> |
||
136 | <td class="md" nowrap valign="top">void </td> |
||
137 | <td class="mdname1" valign="top" nowrap> </td> |
||
138 | <td class="md" valign="top"> ) </td> |
||
139 | <td class="md" nowrap></td> |
||
140 | </tr> |
||
141 | </table> |
||
142 | </td> |
||
143 | </tr> |
||
144 | </table> |
||
145 | <table cellspacing="5" cellpadding="0" border="0"> |
||
146 | <tr> |
||
147 | <td> |
||
148 | |
||
149 | </td> |
||
150 | <td> |
||
151 | |||
152 | <p> |
||
153 | Read the state of pushbuttons on the spyglass UI. Returns an 8-bit number representing the state of buttons S1-S7 in bits 0-6 respectively.<ul> |
||
154 | <li>'0' bit value = button not pressed</li><li>'1' bit value = button is pressed </li></ul> |
||
155 | |||
156 | <p> |
||
157 | Definition at line <a class="el" href="spyglass_8c-source.html#l00051">51</a> of file <a class="el" href="spyglass_8c-source.html">spyglass.c</a>. </td> |
||
158 | </tr> |
||
159 | </table> |
||
160 | <a class="anchor" name="ga3" doxytag="spyglass.h::spyglassSetBeeper"></a><p> |
||
161 | <table class="mdTable" cellpadding="2" cellspacing="0"> |
||
162 | <tr> |
||
163 | <td class="mdRow"> |
||
164 | <table cellpadding="0" cellspacing="0" border="0"> |
||
165 | <tr> |
||
166 | <td class="md" nowrap valign="top">void spyglassSetBeeper </td> |
||
167 | <td class="md" valign="top">( </td> |
||
168 | <td class="md" nowrap valign="top">u08 </td> |
||
169 | <td class="mdname1" valign="top" nowrap> <em>state</em> </td> |
||
170 | <td class="md" valign="top"> ) </td> |
||
171 | <td class="md" nowrap></td> |
||
172 | </tr> |
||
173 | </table> |
||
174 | </td> |
||
175 | </tr> |
||
176 | </table> |
||
177 | <table cellspacing="5" cellpadding="0" border="0"> |
||
178 | <tr> |
||
179 | <td> |
||
180 | |
||
181 | </td> |
||
182 | <td> |
||
183 | |||
184 | <p> |
||
185 | Sets the state of the beeper on the spyglass UI.<ul> |
||
186 | <li>'0' state => beeper off</li><li>'1' state => beeper on </li></ul> |
||
187 | |||
188 | <p> |
||
189 | Definition at line <a class="el" href="spyglass_8c-source.html#l00062">62</a> of file <a class="el" href="spyglass_8c-source.html">spyglass.c</a>. </td> |
||
190 | </tr> |
||
191 | </table> |
||
192 | <a class="anchor" name="ga4" doxytag="spyglass.h::spyglassSetLcdContrast"></a><p> |
||
193 | <table class="mdTable" cellpadding="2" cellspacing="0"> |
||
194 | <tr> |
||
195 | <td class="mdRow"> |
||
196 | <table cellpadding="0" cellspacing="0" border="0"> |
||
197 | <tr> |
||
198 | <td class="md" nowrap valign="top">u08 spyglassSetLcdContrast </td> |
||
199 | <td class="md" valign="top">( </td> |
||
200 | <td class="md" nowrap valign="top">u08 </td> |
||
201 | <td class="mdname1" valign="top" nowrap> <em>contrast</em> </td> |
||
202 | <td class="md" valign="top"> ) </td> |
||
203 | <td class="md" nowrap></td> |
||
204 | </tr> |
||
205 | </table> |
||
206 | </td> |
||
207 | </tr> |
||
208 | </table> |
||
209 | <table cellspacing="5" cellpadding="0" border="0"> |
||
210 | <tr> |
||
211 | <td> |
||
212 | |
||
213 | </td> |
||
214 | <td> |
||
215 | |||
216 | <p> |
||
217 | Sets the contrast voltage of the spyglass LCD. Lower numbers are darker contrast, higher numbers are lighter contrast. |
||
218 | <p> |
||
219 | Definition at line <a class="el" href="spyglass_8c-source.html#l00071">71</a> of file <a class="el" href="spyglass_8c-source.html">spyglass.c</a>. </td> |
||
220 | </tr> |
||
221 | </table> |
||
222 | <a class="anchor" name="ga2" doxytag="spyglass.h::spyglassSetLeds"></a><p> |
||
223 | <table class="mdTable" cellpadding="2" cellspacing="0"> |
||
224 | <tr> |
||
225 | <td class="mdRow"> |
||
226 | <table cellpadding="0" cellspacing="0" border="0"> |
||
227 | <tr> |
||
228 | <td class="md" nowrap valign="top">void spyglassSetLeds </td> |
||
229 | <td class="md" valign="top">( </td> |
||
230 | <td class="md" nowrap valign="top">u08 </td> |
||
231 | <td class="mdname1" valign="top" nowrap> <em>leds</em> </td> |
||
232 | <td class="md" valign="top"> ) </td> |
||
233 | <td class="md" nowrap></td> |
||
234 | </tr> |
||
235 | </table> |
||
236 | </td> |
||
237 | </tr> |
||
238 | </table> |
||
239 | <table cellspacing="5" cellpadding="0" border="0"> |
||
240 | <tr> |
||
241 | <td> |
||
242 | |
||
243 | </td> |
||
244 | <td> |
||
245 | |||
246 | <p> |
||
247 | Sets the state of LEDs on the spyglass UI. Argument is a 2-bit number representing the desired state of LEDs D2 & D3 respectively.<ul> |
||
248 | <li>'0' bit value = LED off</li><li>'1' bit value = LED on </li></ul> |
||
249 | |||
250 | <p> |
||
251 | Definition at line <a class="el" href="spyglass_8c-source.html#l00056">56</a> of file <a class="el" href="spyglass_8c-source.html">spyglass.c</a>. </td> |
||
252 | </tr> |
||
253 | </table> |
||
254 | <hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:09 2006 for Procyon AVRlib by |
||
255 | <a href="http://www.doxygen.org/index.html"> |
||
256 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address> |
||
257 | </body> |
||
258 | </html> |
Powered by WebSVN v2.8.3