?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 6

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.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&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
8 <h1>spyglass.h</h1><a href="spyglass_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file spyglass.h \brief Spyglass Control Panel UI Board Driver. */</span>
9 00002 <span class="comment">//*****************************************************************************</span>
10 00003 <span class="comment">//</span>
11 00004 <span class="comment">// File Name : 'spyglass.h'</span>
12 00005 <span class="comment">// Title : Spyglass Control Panel UI Board Driver</span>
13 00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2005</span>
14 00007 <span class="comment">// Created : 7/20/2005</span>
15 00008 <span class="comment">// Revised : 7/23/2005</span>
16 00009 <span class="comment">// Version : 0.9</span>
17 00010 <span class="comment">// Target MCU : Atmel AVR series</span>
18 00011 <span class="comment">// Editor Tabs : 4</span>
19 00012 <span class="comment">//</span><span class="comment"></span>
20 00013 <span class="comment">/// \ingroup driver_hw</span>
21 00014 <span class="comment">/// \defgroup spyglass Spyglass Control Panel UI Board Driver (spyglass.c)</span>
22 00015 <span class="comment">/// \code</span>
23 00016 <span class="comment">/// #include "lcd.h"</span>
24 00017 <span class="comment">/// #include "i2c.h"</span>
25 00018 <span class="comment">/// #include "spyglass.h"</span>
26 00019 <span class="comment">/// \endcode</span>
27 00020 <span class="comment">/// \par Overview</span>
28 00021 <span class="comment">/// This library supports the 'Spyglass' I2C-controlled User Interface</span>
29 00022 <span class="comment">/// board. The Spyglass board has a standard 4x20 character LCD and a</span>
30 00023 <span class="comment">/// convenient array of pushbuttons for a user interface. The board also</span>
31 00024 <span class="comment">/// has a user-controllable piezo beeper. All of these functions are</span>
32 00025 <span class="comment">/// accessible via I2C bus, making it possible to have a complete user</span>
33 00026 <span class="comment">/// interface with just 4 wires (2 I/O and 2 power wires). The Spyglass</span>
34 00027 <span class="comment">/// board runs on 5V power.</span>
35 00028 <span class="comment">///</span>
36 00029 <span class="comment">/// \par Connections:</span>
37 00030 <span class="comment">/// - Connect power to the +5V and ground pins.</span>
38 00031 <span class="comment">/// - Connect the SCL/SDA pins to the corresponding SCL/SDA pins of</span>
39 00032 <span class="comment">/// your processor's I2C bus.</span>
40 00033 <span class="comment">/// - If you wish to use the beeper, also connect +5V to pin 8.</span>
41 00034 <span class="comment">///</span>
42 00035 <span class="comment">/// \code</span>
43 00036 <span class="comment">/// SPYGLASS PINOUT for 10-pin I/O header:</span>
44 00037 <span class="comment">///</span>
45 00038 <span class="comment">/// ----</span>
46 00039 <span class="comment">/// +5V - 1 |++| 2 - +5V</span>
47 00040 <span class="comment">/// SCL - 3 |++| 4 - GND</span>
48 00041 <span class="comment">/// SDA - 5 |++| 6 - GND</span>
49 00042 <span class="comment">/// 7 |++| 8 - BEEPER PWR (+5V)</span>
50 00043 <span class="comment">/// 9 |++| 10</span>
51 00044 <span class="comment">/// ----</span>
52 00045 <span class="comment">/// \endcode</span>
53 00046 <span class="comment"></span><span class="comment">//</span>
54 00047 <span class="comment">// This code is distributed under the GNU Public License</span>
55 00048 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span>
56 00049 <span class="comment">//</span>
57 00050 <span class="comment">//*****************************************************************************</span><span class="comment"></span>
58 00051 <span class="comment">//@{</span>
59 00052 <span class="comment"></span>
60 00053 <span class="preprocessor">#ifndef SPYGLASS_H</span>
61 00054 <span class="preprocessor"></span><span class="preprocessor">#define SPYGLASS_H</span>
62 00055 <span class="preprocessor"></span>
63 00056 <span class="comment">// defines</span>
64 00057 <span class="comment">// Base I2C node addresses</span>
65 00058 <span class="preprocessor">#define PCF8574_I2C_BASE_ADDR 0x40</span>
66 00059 <span class="preprocessor"></span><span class="preprocessor">#define MAX517_I2C_BASE_ADDR 0x58</span>
67 00060 <span class="preprocessor"></span>
68 00061 <span class="comment">// PCF8574 node addresses</span>
69 00062 <span class="preprocessor">#define PCF_NODE_BUTTONS 0x00</span>
70 00063 <span class="preprocessor"></span><span class="preprocessor">#define PCF_NODE_LCD_DATA 0x01</span>
71 00064 <span class="preprocessor"></span><span class="preprocessor">#define PCF_NODE_CONTROL 0x02</span>
72 00065 <span class="preprocessor"></span>
73 00066 <span class="comment">// Control node bit-defines</span>
74 00067 <span class="preprocessor">#define SPYGLASS_LED0 0x01</span>
75 00068 <span class="preprocessor"></span><span class="preprocessor">#define SPYGLASS_LED1 0x02</span>
76 00069 <span class="preprocessor"></span><span class="preprocessor">#define SPYGLASS_BEEPER 0x04</span>
77 00070 <span class="preprocessor"></span><span class="preprocessor">#define SPYGLASS_LCD_RS 0x20</span>
78 00071 <span class="preprocessor"></span><span class="preprocessor">#define SPYGLASS_LCD_RW 0x40</span>
79 00072 <span class="preprocessor"></span><span class="preprocessor">#define SPYGLASS_LCD_E 0x80</span>
80 00073 <span class="preprocessor"></span>
81 00074 <span class="comment">// map lcd.c commands to spyglass.c LCD commands</span>
82 00075 <span class="preprocessor">#define lcdInit spyglassLcdInit</span>
83 00076 <span class="preprocessor"></span><span class="preprocessor">#define lcdHome spyglassLcdHome</span>
84 00077 <span class="preprocessor"></span><span class="preprocessor">#define lcdClear spyglassLcdClear</span>
85 00078 <span class="preprocessor"></span><span class="preprocessor">#define lcdGotoXY spyglassLcdGotoXY</span>
86 00079 <span class="preprocessor"></span><span class="preprocessor">#define lcdDataWrite spyglassLcdWriteChar</span>
87 00080 <span class="preprocessor"></span>
88 00081 <span class="comment">// functions</span><span class="comment"></span>
89 00082 <span class="comment">//! initialize the I2C bus for communication with the spyglass UI.</span>
90 00083 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__spyglass.html#ga0">spyglassInit</a>(<span class="keywordtype">void</span>);
91 00084
92 00085 <span class="comment">// *********** MISC INPUT/OUTPUT commands ***********</span>
93 00086 <span class="comment"></span>
94 00087 <span class="comment">//! Read the state of pushbuttons on the spyglass UI.</span>
95 00088 <span class="comment">/// Returns an 8-bit number representing the state of buttons S1-S7 in bits 0-6 respectively.</span>
96 00089 <span class="comment">/// - '0' bit value = button not pressed</span>
97 00090 <span class="comment">/// - '1' bit value = button is pressed</span>
98 00091 <span class="comment"></span>u08 <a class="code" href="group__spyglass.html#ga1">spyglassGetPushbuttons</a>(<span class="keywordtype">void</span>);
99 00092 <span class="comment"></span>
100 00093 <span class="comment">//! Sets the state of LEDs on the spyglass UI.</span>
101 00094 <span class="comment">/// Argument is a 2-bit number representing the desired state of LEDs D2 &amp; D3 respectively.</span>
102 00095 <span class="comment">/// - '0' bit value = LED off</span>
103 00096 <span class="comment">/// - '1' bit value = LED on</span>
104 00097 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__spyglass.html#ga2">spyglassSetLeds</a>(u08 leds);
105 00098 <span class="comment"></span>
106 00099 <span class="comment">//! Sets the state of the beeper on the spyglass UI.</span>
107 00100 <span class="comment">/// - '0' state =&gt; beeper off</span>
108 00101 <span class="comment">/// - '1' state =&gt; beeper on</span>
109 00102 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__spyglass.html#ga3">spyglassSetBeeper</a>(u08 state);
110 00103 <span class="comment"></span>
111 00104 <span class="comment">//! Sets the contrast voltage of the spyglass LCD.</span>
112 00105 <span class="comment">/// Lower numbers are darker contrast, higher numbers are lighter contrast.</span>
113 00106 <span class="comment"></span>u08 <a class="code" href="group__spyglass.html#ga4">spyglassSetLcdContrast</a>(u08 contrast);
114 00107
115 00108 <span class="comment">// *********** LCD commands ***********</span>
116 00109 <span class="comment"></span>
117 00110 <span class="comment">//! Initialize LCD for operation.</span>
118 00111 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__spyglass.html#ga5">spyglassLcdInit</a>(<span class="keywordtype">void</span>);<span class="comment"></span>
119 00112 <span class="comment">//! Set write/cursor position to upper left. </span>
120 00113 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__spyglass.html#ga6">spyglassLcdHome</a>(<span class="keywordtype">void</span>);<span class="comment"></span>
121 00114 <span class="comment">//! Clear LCD display.</span>
122 00115 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__spyglass.html#ga7">spyglassLcdClear</a>(<span class="keywordtype">void</span>);<span class="comment"></span>
123 00116 <span class="comment">//! Set write/cursor posision on LCD display (x=col, y=line).</span>
124 00117 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__spyglass.html#ga8">spyglassLcdGotoXY</a>(u08 x, u08 y);<span class="comment"></span>
125 00118 <span class="comment">//! Write control or display data to LCD.</span>
126 00119 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__spyglass.html#ga9">spyglassLcdWrite</a>(u08 rs, u08 data);<span class="comment"></span>
127 00120 <span class="comment">//! Write character to LCD.</span>
128 00121 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__spyglass.html#ga10">spyglassLcdWriteChar</a>(u08 c);
129 00122
130 00123 <span class="comment">// *********** LOW-LEVEL ACCESS ***********</span>
131 00124 <span class="comment"></span>
132 00125 <span class="comment">//! Write I/O Data to PCF8574 I2C&lt;-&gt;Digital I/O chip.</span>
133 00126 <span class="comment"></span>u08 <a class="code" href="group__spyglass.html#ga11">pcf8574Write</a>(u08 nodeAddr, u08 data);<span class="comment"></span>
134 00127 <span class="comment">//! Read I/O Data from PCF8574 I2C&lt;-&gt;Digital I/O chip.</span>
135 00128 <span class="comment"></span>u08 <a class="code" href="group__spyglass.html#ga12">pcf8574Read</a>(u08 nodeAddr);
136 00129
137 00130 <span class="preprocessor">#endif</span>
138 00131 <span class="preprocessor"></span><span class="comment">//@}</span>
139 </span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:07 2006 for Procyon AVRlib by&nbsp;
140 <a href="http://www.doxygen.org/index.html">
141 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
142 </body>
143 </html>
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3