?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: i2c.h File Reference</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>i2c.h File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
9  
10 <p>
11 Definition in file <a class="el" href="i2c_8h-source.html">i2c.h</a>.
12 <p>
13 <code>#include "<a class="el" href="global_8h-source.html">global.h</a>"</code><br>
14 <code>#include "<a class="el" href="i2cconf_8h-source.html">i2cconf.h</a>"</code><br>
15  
16 <p>
17 <a href="i2c_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
18 <tr><td></td></tr>
19 <tr><td colspan="2"><br><h2>Defines</h2></td></tr>
20 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a0" doxytag="i2c.h::TW_START"></a>
21 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_START</b>&nbsp;&nbsp;&nbsp;0x08</td></tr>
22  
23 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a1" doxytag="i2c.h::TW_REP_START"></a>
24 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_REP_START</b>&nbsp;&nbsp;&nbsp;0x10</td></tr>
25  
26 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a2" doxytag="i2c.h::TW_MT_SLA_ACK"></a>
27 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_MT_SLA_ACK</b>&nbsp;&nbsp;&nbsp;0x18</td></tr>
28  
29 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a3" doxytag="i2c.h::TW_MT_SLA_NACK"></a>
30 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_MT_SLA_NACK</b>&nbsp;&nbsp;&nbsp;0x20</td></tr>
31  
32 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a4" doxytag="i2c.h::TW_MT_DATA_ACK"></a>
33 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_MT_DATA_ACK</b>&nbsp;&nbsp;&nbsp;0x28</td></tr>
34  
35 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a5" doxytag="i2c.h::TW_MT_DATA_NACK"></a>
36 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_MT_DATA_NACK</b>&nbsp;&nbsp;&nbsp;0x30</td></tr>
37  
38 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a6" doxytag="i2c.h::TW_MT_ARB_LOST"></a>
39 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_MT_ARB_LOST</b>&nbsp;&nbsp;&nbsp;0x38</td></tr>
40  
41 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a7" doxytag="i2c.h::TW_MR_ARB_LOST"></a>
42 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_MR_ARB_LOST</b>&nbsp;&nbsp;&nbsp;0x38</td></tr>
43  
44 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a8" doxytag="i2c.h::TW_MR_SLA_ACK"></a>
45 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_MR_SLA_ACK</b>&nbsp;&nbsp;&nbsp;0x40</td></tr>
46  
47 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a9" doxytag="i2c.h::TW_MR_SLA_NACK"></a>
48 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_MR_SLA_NACK</b>&nbsp;&nbsp;&nbsp;0x48</td></tr>
49  
50 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a10" doxytag="i2c.h::TW_MR_DATA_ACK"></a>
51 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_MR_DATA_ACK</b>&nbsp;&nbsp;&nbsp;0x50</td></tr>
52  
53 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a11" doxytag="i2c.h::TW_MR_DATA_NACK"></a>
54 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_MR_DATA_NACK</b>&nbsp;&nbsp;&nbsp;0x58</td></tr>
55  
56 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a12" doxytag="i2c.h::TW_ST_SLA_ACK"></a>
57 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_ST_SLA_ACK</b>&nbsp;&nbsp;&nbsp;0xA8</td></tr>
58  
59 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a13" doxytag="i2c.h::TW_ST_ARB_LOST_SLA_ACK"></a>
60 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_ST_ARB_LOST_SLA_ACK</b>&nbsp;&nbsp;&nbsp;0xB0</td></tr>
61  
62 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a14" doxytag="i2c.h::TW_ST_DATA_ACK"></a>
63 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_ST_DATA_ACK</b>&nbsp;&nbsp;&nbsp;0xB8</td></tr>
64  
65 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a15" doxytag="i2c.h::TW_ST_DATA_NACK"></a>
66 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_ST_DATA_NACK</b>&nbsp;&nbsp;&nbsp;0xC0</td></tr>
67  
68 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a16" doxytag="i2c.h::TW_ST_LAST_DATA"></a>
69 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_ST_LAST_DATA</b>&nbsp;&nbsp;&nbsp;0xC8</td></tr>
70  
71 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a17" doxytag="i2c.h::TW_SR_SLA_ACK"></a>
72 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_SR_SLA_ACK</b>&nbsp;&nbsp;&nbsp;0x60</td></tr>
73  
74 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a18" doxytag="i2c.h::TW_SR_ARB_LOST_SLA_ACK"></a>
75 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_SR_ARB_LOST_SLA_ACK</b>&nbsp;&nbsp;&nbsp;0x68</td></tr>
76  
77 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a19" doxytag="i2c.h::TW_SR_GCALL_ACK"></a>
78 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_SR_GCALL_ACK</b>&nbsp;&nbsp;&nbsp;0x70</td></tr>
79  
80 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a20" doxytag="i2c.h::TW_SR_ARB_LOST_GCALL_ACK"></a>
81 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_SR_ARB_LOST_GCALL_ACK</b>&nbsp;&nbsp;&nbsp;0x78</td></tr>
82  
83 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a21" doxytag="i2c.h::TW_SR_DATA_ACK"></a>
84 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_SR_DATA_ACK</b>&nbsp;&nbsp;&nbsp;0x80</td></tr>
85  
86 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a22" doxytag="i2c.h::TW_SR_DATA_NACK"></a>
87 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_SR_DATA_NACK</b>&nbsp;&nbsp;&nbsp;0x88</td></tr>
88  
89 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a23" doxytag="i2c.h::TW_SR_GCALL_DATA_ACK"></a>
90 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_SR_GCALL_DATA_ACK</b>&nbsp;&nbsp;&nbsp;0x90</td></tr>
91  
92 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a24" doxytag="i2c.h::TW_SR_GCALL_DATA_NACK"></a>
93 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_SR_GCALL_DATA_NACK</b>&nbsp;&nbsp;&nbsp;0x98</td></tr>
94  
95 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a25" doxytag="i2c.h::TW_SR_STOP"></a>
96 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_SR_STOP</b>&nbsp;&nbsp;&nbsp;0xA0</td></tr>
97  
98 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a26" doxytag="i2c.h::TW_NO_INFO"></a>
99 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_NO_INFO</b>&nbsp;&nbsp;&nbsp;0xF8</td></tr>
100  
101 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a27" doxytag="i2c.h::TW_BUS_ERROR"></a>
102 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TW_BUS_ERROR</b>&nbsp;&nbsp;&nbsp;0x00</td></tr>
103  
104 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a28" doxytag="i2c.h::TWCR_CMD_MASK"></a>
105 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TWCR_CMD_MASK</b>&nbsp;&nbsp;&nbsp;0x0F</td></tr>
106  
107 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a29" doxytag="i2c.h::TWSR_STATUS_MASK"></a>
108 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TWSR_STATUS_MASK</b>&nbsp;&nbsp;&nbsp;0xF8</td></tr>
109  
110 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a30" doxytag="i2c.h::I2C_OK"></a>
111 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>I2C_OK</b>&nbsp;&nbsp;&nbsp;0x00</td></tr>
112  
113 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a31" doxytag="i2c.h::I2C_ERROR_NODEV"></a>
114 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>I2C_ERROR_NODEV</b>&nbsp;&nbsp;&nbsp;0x01</td></tr>
115  
116 <tr><td colspan="2"><br><h2>Enumerations</h2></td></tr>
117 <tr><td class="memItemLeft" nowrap align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><b>eI2cStateType</b> { <br>
118 &nbsp;&nbsp;<b>I2C_IDLE</b> = 0,
119 <b>I2C_BUSY</b> = 1,
120 <b>I2C_MASTER_TX</b> = 2,
121 <b>I2C_MASTER_RX</b> = 3,
122 <br>
123 &nbsp;&nbsp;<b>I2C_SLAVE_TX</b> = 4,
124 <b>I2C_SLAVE_RX</b> = 5
125 <br>
126 }</td></tr>
127  
128 <tr><td colspan="2"><br><h2>Functions</h2></td></tr>
129 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a38" doxytag="i2c.h::i2cInit"></a>
130 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a38">i2cInit</a> (void)</td></tr>
131  
132 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialize I2C (TWI) interface. <br></td></tr>
133 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a39" doxytag="i2c.h::i2cSetBitrate"></a>
134 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a39">i2cSetBitrate</a> (u16 bitrateKHz)</td></tr>
135  
136 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the I2C transaction bitrate (in KHz). <br></td></tr>
137 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a40" doxytag="i2c.h::i2cSetLocalDeviceAddr"></a>
138 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a40">i2cSetLocalDeviceAddr</a> (u08 deviceAddr, u08 genCallEn)</td></tr>
139  
140 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the local (AVR processor's) I2C device address. <br></td></tr>
141 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a41" doxytag="i2c.h::i2cSetSlaveReceiveHandler"></a>
142 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a41">i2cSetSlaveReceiveHandler</a> (void(*i2cSlaveRx_func)(u08 receiveDataLength, u08 *recieveData))</td></tr>
143  
144 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the user function which handles receiving (incoming) data as a slave. <br></td></tr>
145 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a42" doxytag="i2c.h::i2cSetSlaveTransmitHandler"></a>
146 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a42">i2cSetSlaveTransmitHandler</a> (u08(*i2cSlaveTx_func)(u08 transmitDataLengthMax, u08 *transmitData))</td></tr>
147  
148 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the user function which handles transmitting (outgoing) data as a slave. <br></td></tr>
149 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a43" doxytag="i2c.h::i2cSendStart"></a>
150 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a43">i2cSendStart</a> (void)</td></tr>
151  
152 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Send an I2C start condition in Master mode. <br></td></tr>
153 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a44" doxytag="i2c.h::i2cSendStop"></a>
154 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a44">i2cSendStop</a> (void)</td></tr>
155  
156 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Send an I2C stop condition in Master mode. <br></td></tr>
157 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a45" doxytag="i2c.h::i2cWaitForComplete"></a>
158 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a45">i2cWaitForComplete</a> (void)</td></tr>
159  
160 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Wait for current I2C operation to complete. <br></td></tr>
161 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a46" doxytag="i2c.h::i2cSendByte"></a>
162 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a46">i2cSendByte</a> (u08 data)</td></tr>
163  
164 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Send an (address|R/W) combination or a data byte over I2C. <br></td></tr>
165 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a47" doxytag="i2c.h::i2cReceiveByte"></a>
166 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a47">i2cReceiveByte</a> (u08 ackFlag)</td></tr>
167  
168 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Receive a data byte over I2C. <br></td></tr>
169 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a48" doxytag="i2c.h::i2cGetReceivedByte"></a>
170 u08&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a48">i2cGetReceivedByte</a> (void)</td></tr>
171  
172 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pick up the data that was received with <a class="el" href="i2c_8c.html#a19">i2cReceiveByte()</a>. <br></td></tr>
173 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a49" doxytag="i2c.h::i2cGetStatus"></a>
174 u08&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a49">i2cGetStatus</a> (void)</td></tr>
175  
176 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get current I2c bus status from TWSR. <br></td></tr>
177 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a50" doxytag="i2c.h::i2cMasterSend"></a>
178 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a50">i2cMasterSend</a> (u08 deviceAddr, u08 length, u08 *data)</td></tr>
179  
180 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">send I2C data to a device on the bus <br></td></tr>
181 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a51" doxytag="i2c.h::i2cMasterReceive"></a>
182 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a51">i2cMasterReceive</a> (u08 deviceAddr, u08 length, u08 *data)</td></tr>
183  
184 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">receive I2C data from a device on the bus <br></td></tr>
185 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a52" doxytag="i2c.h::i2cMasterSendNI"></a>
186 u08&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a52">i2cMasterSendNI</a> (u08 deviceAddr, u08 length, u08 *data)</td></tr>
187  
188 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">send I2C data to a device on the bus (non-interrupt based) <br></td></tr>
189 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a53" doxytag="i2c.h::i2cMasterReceiveNI"></a>
190 u08&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a53">i2cMasterReceiveNI</a> (u08 deviceAddr, u08 length, u08 *data)</td></tr>
191  
192 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">receive I2C data from a device on the bus (non-interrupt based) <br></td></tr>
193 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a54" doxytag="i2c.h::i2cGetState"></a>
194 eI2cStateType&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="i2c_8h.html#a54">i2cGetState</a> (void)</td></tr>
195  
196 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the current high-level state of the I2C interface. <br></td></tr>
197 </table>
198 <hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:08 2006 for Procyon AVRlib by&nbsp;
199 <a href="http://www.doxygen.org/index.html">
200 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
201 </body>
202 </html>
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3