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

library

?curdirlinks? - Rev 6

?prevdifflink? - Blame - ?getfile?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Procyon AVRlib: spyglass.h Source File</title>
<link href="dox.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<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>
<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>
00002 <span class="comment">//*****************************************************************************</span>
00003 <span class="comment">//</span>
00004 <span class="comment">// File Name    : 'spyglass.h'</span>
00005 <span class="comment">// Title        : Spyglass Control Panel UI Board Driver</span>
00006 <span class="comment">// Author       : Pascal Stang - Copyright (C) 2005</span>
00007 <span class="comment">// Created      : 7/20/2005</span>
00008 <span class="comment">// Revised      : 7/23/2005</span>
00009 <span class="comment">// Version      : 0.9</span>
00010 <span class="comment">// Target MCU   : Atmel AVR series</span>
00011 <span class="comment">// Editor Tabs  : 4</span>
00012 <span class="comment">//</span><span class="comment"></span>
00013 <span class="comment">/// \ingroup driver_hw</span>
00014 <span class="comment">/// \defgroup spyglass Spyglass Control Panel UI Board Driver (spyglass.c)</span>
00015 <span class="comment">/// \code</span>
00016 <span class="comment">///     #include "lcd.h"</span>
00017 <span class="comment">///     #include "i2c.h"</span>
00018 <span class="comment">///     #include "spyglass.h"</span>
00019 <span class="comment">/// \endcode</span>
00020 <span class="comment">/// \par Overview</span>
00021 <span class="comment">///     This library supports the 'Spyglass' I2C-controlled User Interface</span>
00022 <span class="comment">///     board.  The Spyglass board has a standard 4x20 character LCD and a</span>
00023 <span class="comment">///     convenient array of pushbuttons for a user interface.  The board also</span>
00024 <span class="comment">///     has a user-controllable piezo beeper.  All of these functions are</span>
00025 <span class="comment">///     accessible via I2C bus, making it possible to have a complete user</span>
00026 <span class="comment">///     interface with just 4 wires (2 I/O and 2 power wires).  The Spyglass</span>
00027 <span class="comment">///     board runs on 5V power.</span>
00028 <span class="comment">///</span>
00029 <span class="comment">/// \par Connections:</span>
00030 <span class="comment">///     - Connect power to the +5V and ground pins.</span>
00031 <span class="comment">///     - Connect the SCL/SDA pins to the corresponding SCL/SDA pins of</span>
00032 <span class="comment">///          your processor's I2C bus.</span>
00033 <span class="comment">///     - If you wish to use the beeper, also connect +5V to pin 8.</span>
00034 <span class="comment">///</span>
00035 <span class="comment">/// \code</span>
00036 <span class="comment">///  SPYGLASS PINOUT for 10-pin I/O header:</span>
00037 <span class="comment">///</span>
00038 <span class="comment">///             ----</span>
00039 <span class="comment">///     +5V - 1 |++| 2 - +5V</span>
00040 <span class="comment">///     SCL - 3 |++| 4 - GND</span>
00041 <span class="comment">///     SDA - 5 |++| 6 - GND</span>
00042 <span class="comment">///           7 |++| 8 - BEEPER PWR (+5V)</span>
00043 <span class="comment">///           9 |++| 10</span>
00044 <span class="comment">///             ----</span>
00045 <span class="comment">/// \endcode</span>
00046 <span class="comment"></span><span class="comment">//</span>
00047 <span class="comment">// This code is distributed under the GNU Public License</span>
00048 <span class="comment">//      which can be found at http://www.gnu.org/licenses/gpl.txt</span>
00049 <span class="comment">//</span>
00050 <span class="comment">//*****************************************************************************</span><span class="comment"></span>
00051 <span class="comment">//@{</span>
00052 <span class="comment"></span>
00053 <span class="preprocessor">#ifndef SPYGLASS_H</span>
00054 <span class="preprocessor"></span><span class="preprocessor">#define SPYGLASS_H</span>
00055 <span class="preprocessor"></span>
00056 <span class="comment">// defines</span>
00057 <span class="comment">// Base I2C node addresses</span>
00058 <span class="preprocessor">#define PCF8574_I2C_BASE_ADDR   0x40</span>
00059 <span class="preprocessor"></span><span class="preprocessor">#define MAX517_I2C_BASE_ADDR    0x58</span>
00060 <span class="preprocessor"></span>
00061 <span class="comment">// PCF8574 node addresses</span>
00062 <span class="preprocessor">#define PCF_NODE_BUTTONS        0x00</span>
00063 <span class="preprocessor"></span><span class="preprocessor">#define PCF_NODE_LCD_DATA       0x01</span>
00064 <span class="preprocessor"></span><span class="preprocessor">#define PCF_NODE_CONTROL        0x02</span>
00065 <span class="preprocessor"></span>
00066 <span class="comment">// Control node bit-defines</span>
00067 <span class="preprocessor">#define SPYGLASS_LED0       0x01</span>
00068 <span class="preprocessor"></span><span class="preprocessor">#define SPYGLASS_LED1       0x02</span>
00069 <span class="preprocessor"></span><span class="preprocessor">#define SPYGLASS_BEEPER     0x04</span>
00070 <span class="preprocessor"></span><span class="preprocessor">#define SPYGLASS_LCD_RS     0x20</span>
00071 <span class="preprocessor"></span><span class="preprocessor">#define SPYGLASS_LCD_RW     0x40</span>
00072 <span class="preprocessor"></span><span class="preprocessor">#define SPYGLASS_LCD_E      0x80</span>
00073 <span class="preprocessor"></span>
00074 <span class="comment">// map lcd.c commands to spyglass.c LCD commands</span>
00075 <span class="preprocessor">#define lcdInit         spyglassLcdInit</span>
00076 <span class="preprocessor"></span><span class="preprocessor">#define lcdHome         spyglassLcdHome</span>
00077 <span class="preprocessor"></span><span class="preprocessor">#define lcdClear        spyglassLcdClear</span>
00078 <span class="preprocessor"></span><span class="preprocessor">#define lcdGotoXY       spyglassLcdGotoXY</span>
00079 <span class="preprocessor"></span><span class="preprocessor">#define lcdDataWrite    spyglassLcdWriteChar</span>
00080 <span class="preprocessor"></span>
00081 <span class="comment">// functions</span><span class="comment"></span>
00082 <span class="comment">//! initialize the I2C bus for communication with the spyglass UI.</span>
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>);
00084 
00085 <span class="comment">// *********** MISC INPUT/OUTPUT commands ***********</span>
00086 <span class="comment"></span>
00087 <span class="comment">//! Read the state of pushbuttons on the spyglass UI.</span>
00088 <span class="comment">/// Returns an 8-bit number representing the state of buttons S1-S7 in bits 0-6 respectively.</span>
00089 <span class="comment">///  - '0' bit value = button not pressed</span>
00090 <span class="comment">///  - '1' bit value = button is pressed</span>
00091 <span class="comment"></span>u08 <a class="code" href="group__spyglass.html#ga1">spyglassGetPushbuttons</a>(<span class="keywordtype">void</span>);
00092 <span class="comment"></span>
00093 <span class="comment">//! Sets the state of LEDs on the spyglass UI.</span>
00094 <span class="comment">/// Argument is a 2-bit number representing the desired state of LEDs D2 &amp; D3 respectively.</span>
00095 <span class="comment">///  - '0' bit value = LED off</span>
00096 <span class="comment">///  - '1' bit value = LED on</span>
00097 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__spyglass.html#ga2">spyglassSetLeds</a>(u08 leds);
00098 <span class="comment"></span>
00099 <span class="comment">//! Sets the state of the beeper on the spyglass UI.</span>
00100 <span class="comment">/// - '0' state =&gt; beeper off</span>
00101 <span class="comment">/// - '1' state =&gt; beeper on</span>
00102 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__spyglass.html#ga3">spyglassSetBeeper</a>(u08 state);
00103 <span class="comment"></span>
00104 <span class="comment">//! Sets the contrast voltage of the spyglass LCD.</span>
00105 <span class="comment">/// Lower numbers are darker contrast, higher numbers are lighter contrast.</span>
00106 <span class="comment"></span>u08 <a class="code" href="group__spyglass.html#ga4">spyglassSetLcdContrast</a>(u08 contrast);
00107 
00108 <span class="comment">// *********** LCD commands ***********</span>
00109 <span class="comment"></span>
00110 <span class="comment">//! Initialize LCD for operation.</span>
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>
00112 <span class="comment">//! Set write/cursor position to upper left. </span>
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>
00114 <span class="comment">//! Clear LCD display.</span>
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>
00116 <span class="comment">//! Set write/cursor posision on LCD display (x=col, y=line).</span>
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>
00118 <span class="comment">//! Write control or display data to LCD.</span>
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>
00120 <span class="comment">//! Write character to LCD.</span>
00121 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__spyglass.html#ga10">spyglassLcdWriteChar</a>(u08 c);
00122 
00123 <span class="comment">// *********** LOW-LEVEL ACCESS ***********</span>
00124 <span class="comment"></span>
00125 <span class="comment">//! Write I/O Data to PCF8574 I2C&lt;-&gt;Digital I/O chip.</span>
00126 <span class="comment"></span>u08 <a class="code" href="group__spyglass.html#ga11">pcf8574Write</a>(u08 nodeAddr, u08 data);<span class="comment"></span>
00127 <span class="comment">//! Read I/O Data from PCF8574 I2C&lt;-&gt;Digital I/O chip.</span>
00128 <span class="comment"></span>u08 <a class="code" href="group__spyglass.html#ga12">pcf8574Read</a>(u08 nodeAddr);
00129 
00130 <span class="preprocessor">#endif</span>
00131 <span class="preprocessor"></span><span class="comment">//@}</span>
</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;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>
{FILE END}
{FOOTER START}

Powered by WebSVN v2.8.3