-
Notifications
You must be signed in to change notification settings - Fork 4
/
manual__i2cmaster.html
executable file
·384 lines (364 loc) · 23 KB
/
manual__i2cmaster.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>AVR-GCC Libraries: I2C Master library</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">AVR-GCC Libraries
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">I2C Master library</div> </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>I2C (TWI) Master Software Library. </p>
<div class="fragment"><div class="line"><span class="preprocessor">#include <<a class="code" href="i2cmaster_8h.html">i2cmaster.h</a>></span> </div>
</div><!-- fragment --><p>Basic routines for communicating with I2C slave devices. This single master implementation is limited to one bus master on the I2C bus.</p>
<p>This I2c library is implemented as a compact assembler software implementation of the I2C protocol which runs on any AVR (i2cmaster.S) and as a TWI hardware interface for all AVR with built-in TWI hardware (twimaster.c). Since the API for these two implementations is exactly the same, an application can be linked either against the software I2C implementation or the hardware I2C implementation.</p>
<p>Use 4.7k pull-up resistor on the SDA and SCL pin.</p>
<p>Adapt the SCL and SDA port and pin definitions and eventually the delay routine in the module i2cmaster.S to your target when using the software I2C implementation !</p>
<p>Adjust the CPU clock frequence F_CPU in twimaster.c or in the Makfile when using the TWI hardware implementaion.</p>
<dl class="section note"><dt>Note</dt><dd>The module i2cmaster.S is based on the Atmel Application Note AVR300, corrected and adapted to GNU assembler and AVR-GCC C call interface. Replaced the incorrect quarter period delays found in AVR300 with half period delays.</dd></dl>
<dl class="section author"><dt>Author</dt><dd>Peter Fleury <a href="#" onclick="location.href='mai'+'lto:'+'pfl'+'eu'+'ry@'+'gm'+'x.c'+'h'; return false;">pfleu<span style="display: none;">.nosp@m.</span>ry@g<span style="display: none;">.nosp@m.</span>mx.ch</a> <a href="http://tinyurl.com/peterfleury">http://tinyurl.com/peterfleury</a> </dd></dl>
<dl class="section copyright"><dt>Copyright</dt><dd>(C) 2015 Peter Fleury, GNU General Public License Version 3</dd></dl>
<dl class="section user"><dt>API Usage Example</dt><dd>The following code shows typical usage of this library, see example test_i2cmaster.c</dd></dl>
<div class="fragment"><div class="line"><span class="preprocessor">#include <<a class="code" href="i2cmaster_8h.html">i2cmaster.h</a>></span></div>
<div class="line"></div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#define Dev24C02 0xA2 // device address of EEPROM 24C02, see datasheet</span></div>
<div class="line"></div>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">void</span>)</div>
<div class="line">{</div>
<div class="line"> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> ret;</div>
<div class="line"></div>
<div class="line"> <a class="code" href="group__pfleury__ic2master.html#ga5730d9445429351b9f750084c5cb5aae">i2c_init</a>(); <span class="comment">// initialize I2C library</span></div>
<div class="line"></div>
<div class="line"> <span class="comment">// write 0x75 to EEPROM address 5 (Byte Write) </span></div>
<div class="line"> <a class="code" href="group__pfleury__ic2master.html#gaee3747a01738315cd5580588994b6c28">i2c_start_wait</a>(Dev24C02+<a class="code" href="group__pfleury__ic2master.html#ga9536bf85bced4f4e549a82fb18eb6140">I2C_WRITE</a>); <span class="comment">// set device address and write mode</span></div>
<div class="line"> <a class="code" href="group__pfleury__ic2master.html#gadd947aade44ed6b7f92265f9dec4a711">i2c_write</a>(0x05); <span class="comment">// write address = 5</span></div>
<div class="line"> <a class="code" href="group__pfleury__ic2master.html#gadd947aade44ed6b7f92265f9dec4a711">i2c_write</a>(0x75); <span class="comment">// write value 0x75 to EEPROM</span></div>
<div class="line"> <a class="code" href="group__pfleury__ic2master.html#gad35d4e4f52ca74b503d5e5e1e0a3f5f3">i2c_stop</a>(); <span class="comment">// set stop conditon = release bus</span></div>
<div class="line"></div>
<div class="line"></div>
<div class="line"> <span class="comment">// read previously written value back from EEPROM address 5 </span></div>
<div class="line"> <a class="code" href="group__pfleury__ic2master.html#gaee3747a01738315cd5580588994b6c28">i2c_start_wait</a>(Dev24C02+<a class="code" href="group__pfleury__ic2master.html#ga9536bf85bced4f4e549a82fb18eb6140">I2C_WRITE</a>); <span class="comment">// set device address and write mode</span></div>
<div class="line"></div>
<div class="line"> <a class="code" href="group__pfleury__ic2master.html#gadd947aade44ed6b7f92265f9dec4a711">i2c_write</a>(0x05); <span class="comment">// write address = 5</span></div>
<div class="line"> <a class="code" href="group__pfleury__ic2master.html#ga93a9461da34295250ba935bbce9a980d">i2c_rep_start</a>(Dev24C02+<a class="code" href="group__pfleury__ic2master.html#gab5c0fbe837494c5f9130a5914854250d">I2C_READ</a>); <span class="comment">// set device address and read mode</span></div>
<div class="line"></div>
<div class="line"> ret = <a class="code" href="group__pfleury__ic2master.html#gad89e839fc17b05fbb5dd79897c55234e">i2c_readNak</a>(); <span class="comment">// read one byte from EEPROM</span></div>
<div class="line"> <a class="code" href="group__pfleury__ic2master.html#gad35d4e4f52ca74b503d5e5e1e0a3f5f3">i2c_stop</a>();</div>
<div class="line"></div>
<div class="line"> <span class="keywordflow">for</span>(;;);</div>
<div class="line">}</div>
</div><!-- fragment --> <table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:gab5c0fbe837494c5f9130a5914854250d"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pfleury__ic2master.html#gab5c0fbe837494c5f9130a5914854250d">I2C_READ</a>   1</td></tr>
<tr class="separator:gab5c0fbe837494c5f9130a5914854250d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga9536bf85bced4f4e549a82fb18eb6140"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pfleury__ic2master.html#ga9536bf85bced4f4e549a82fb18eb6140">I2C_WRITE</a>   0</td></tr>
<tr class="separator:ga9536bf85bced4f4e549a82fb18eb6140"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gad33503cf741851d1bca1d274e9001796"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gad33503cf741851d1bca1d274e9001796"></a>
#define </td><td class="memItemRight" valign="bottom"><b>i2c_read</b>(ack)   (ack) ? <a class="el" href="group__pfleury__ic2master.html#ga32ac22052d55f93375b024192217db21">i2c_readAck</a>() : <a class="el" href="group__pfleury__ic2master.html#gad89e839fc17b05fbb5dd79897c55234e">i2c_readNak</a>();</td></tr>
<tr class="separator:gad33503cf741851d1bca1d274e9001796"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga5730d9445429351b9f750084c5cb5aae"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pfleury__ic2master.html#ga5730d9445429351b9f750084c5cb5aae">i2c_init</a> (void)</td></tr>
<tr class="memdesc:ga5730d9445429351b9f750084c5cb5aae"><td class="mdescLeft"> </td><td class="mdescRight">initialize the I2C master interace. Need to be called only once <a href="#ga5730d9445429351b9f750084c5cb5aae">More...</a><br /></td></tr>
<tr class="separator:ga5730d9445429351b9f750084c5cb5aae"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gad35d4e4f52ca74b503d5e5e1e0a3f5f3"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pfleury__ic2master.html#gad35d4e4f52ca74b503d5e5e1e0a3f5f3">i2c_stop</a> (void)</td></tr>
<tr class="memdesc:gad35d4e4f52ca74b503d5e5e1e0a3f5f3"><td class="mdescLeft"> </td><td class="mdescRight">Terminates the data transfer and releases the I2C bus. <a href="#gad35d4e4f52ca74b503d5e5e1e0a3f5f3">More...</a><br /></td></tr>
<tr class="separator:gad35d4e4f52ca74b503d5e5e1e0a3f5f3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga58dfadce0c2fee4bfac01df6cd2b4477"><td class="memItemLeft" align="right" valign="top">unsigned char </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pfleury__ic2master.html#ga58dfadce0c2fee4bfac01df6cd2b4477">i2c_start</a> (unsigned char addr)</td></tr>
<tr class="memdesc:ga58dfadce0c2fee4bfac01df6cd2b4477"><td class="mdescLeft"> </td><td class="mdescRight">Issues a start condition and sends address and transfer direction. <a href="#ga58dfadce0c2fee4bfac01df6cd2b4477">More...</a><br /></td></tr>
<tr class="separator:ga58dfadce0c2fee4bfac01df6cd2b4477"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga93a9461da34295250ba935bbce9a980d"><td class="memItemLeft" align="right" valign="top">unsigned char </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pfleury__ic2master.html#ga93a9461da34295250ba935bbce9a980d">i2c_rep_start</a> (unsigned char addr)</td></tr>
<tr class="memdesc:ga93a9461da34295250ba935bbce9a980d"><td class="mdescLeft"> </td><td class="mdescRight">Issues a repeated start condition and sends address and transfer direction. <a href="#ga93a9461da34295250ba935bbce9a980d">More...</a><br /></td></tr>
<tr class="separator:ga93a9461da34295250ba935bbce9a980d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaee3747a01738315cd5580588994b6c28"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pfleury__ic2master.html#gaee3747a01738315cd5580588994b6c28">i2c_start_wait</a> (unsigned char addr)</td></tr>
<tr class="memdesc:gaee3747a01738315cd5580588994b6c28"><td class="mdescLeft"> </td><td class="mdescRight">Issues a start condition and sends address and transfer direction. <a href="#gaee3747a01738315cd5580588994b6c28">More...</a><br /></td></tr>
<tr class="separator:gaee3747a01738315cd5580588994b6c28"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gadd947aade44ed6b7f92265f9dec4a711"><td class="memItemLeft" align="right" valign="top">unsigned char </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pfleury__ic2master.html#gadd947aade44ed6b7f92265f9dec4a711">i2c_write</a> (unsigned char data)</td></tr>
<tr class="memdesc:gadd947aade44ed6b7f92265f9dec4a711"><td class="mdescLeft"> </td><td class="mdescRight">Send one byte to I2C device. <a href="#gadd947aade44ed6b7f92265f9dec4a711">More...</a><br /></td></tr>
<tr class="separator:gadd947aade44ed6b7f92265f9dec4a711"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga32ac22052d55f93375b024192217db21"><td class="memItemLeft" align="right" valign="top">unsigned char </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pfleury__ic2master.html#ga32ac22052d55f93375b024192217db21">i2c_readAck</a> (void)</td></tr>
<tr class="memdesc:ga32ac22052d55f93375b024192217db21"><td class="mdescLeft"> </td><td class="mdescRight">read one byte from the I2C device, request more data from device <a href="#ga32ac22052d55f93375b024192217db21">More...</a><br /></td></tr>
<tr class="separator:ga32ac22052d55f93375b024192217db21"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gad89e839fc17b05fbb5dd79897c55234e"><td class="memItemLeft" align="right" valign="top">unsigned char </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pfleury__ic2master.html#gad89e839fc17b05fbb5dd79897c55234e">i2c_readNak</a> (void)</td></tr>
<tr class="memdesc:gad89e839fc17b05fbb5dd79897c55234e"><td class="mdescLeft"> </td><td class="mdescRight">read one byte from the I2C device, read is followed by a stop condition <a href="#gad89e839fc17b05fbb5dd79897c55234e">More...</a><br /></td></tr>
<tr class="separator:gad89e839fc17b05fbb5dd79897c55234e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga669c0357614a79b3b35ae815f6f50e82"><td class="memItemLeft" align="right" valign="top">unsigned char </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pfleury__ic2master.html#ga669c0357614a79b3b35ae815f6f50e82">i2c_read</a> (unsigned char ack)</td></tr>
<tr class="memdesc:ga669c0357614a79b3b35ae815f6f50e82"><td class="mdescLeft"> </td><td class="mdescRight">read one byte from the I2C device <a href="#ga669c0357614a79b3b35ae815f6f50e82">More...</a><br /></td></tr>
<tr class="separator:ga669c0357614a79b3b35ae815f6f50e82"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="gab5c0fbe837494c5f9130a5914854250d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define I2C_READ   1</td>
</tr>
</table>
</div><div class="memdoc">
<p>defines the data direction (reading from I2C device) in <a class="el" href="group__pfleury__ic2master.html#ga58dfadce0c2fee4bfac01df6cd2b4477" title="Issues a start condition and sends address and transfer direction. ">i2c_start()</a>,<a class="el" href="group__pfleury__ic2master.html#ga93a9461da34295250ba935bbce9a980d" title="Issues a repeated start condition and sends address and transfer direction. ">i2c_rep_start()</a> </p>
</div>
</div>
<a class="anchor" id="ga9536bf85bced4f4e549a82fb18eb6140"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define I2C_WRITE   0</td>
</tr>
</table>
</div><div class="memdoc">
<p>defines the data direction (writing to I2C device) in <a class="el" href="group__pfleury__ic2master.html#ga58dfadce0c2fee4bfac01df6cd2b4477" title="Issues a start condition and sends address and transfer direction. ">i2c_start()</a>,<a class="el" href="group__pfleury__ic2master.html#ga93a9461da34295250ba935bbce9a980d" title="Issues a repeated start condition and sends address and transfer direction. ">i2c_rep_start()</a> </p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga5730d9445429351b9f750084c5cb5aae"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2c_init </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>initialize the I2C master interace. Need to be called only once </p>
<dl class="section return"><dt>Returns</dt><dd>none </dd></dl>
</div>
</div>
<a class="anchor" id="gad35d4e4f52ca74b503d5e5e1e0a3f5f3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2c_stop </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Terminates the data transfer and releases the I2C bus. </p>
<dl class="section return"><dt>Returns</dt><dd>none </dd></dl>
</div>
</div>
<a class="anchor" id="ga58dfadce0c2fee4bfac01df6cd2b4477"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned char i2c_start </td>
<td>(</td>
<td class="paramtype">unsigned char </td>
<td class="paramname"><em>addr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Issues a start condition and sends address and transfer direction. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">addr</td><td>address and transfer direction of I2C device </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">0</td><td>device accessible </td></tr>
<tr><td class="paramname">1</td><td>failed to access device </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga93a9461da34295250ba935bbce9a980d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned char i2c_rep_start </td>
<td>(</td>
<td class="paramtype">unsigned char </td>
<td class="paramname"><em>addr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Issues a repeated start condition and sends address and transfer direction. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">addr</td><td>address and transfer direction of I2C device </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">0</td><td>device accessible </td></tr>
<tr><td class="paramname">1</td><td>failed to access device </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="gaee3747a01738315cd5580588994b6c28"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2c_start_wait </td>
<td>(</td>
<td class="paramtype">unsigned char </td>
<td class="paramname"><em>addr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Issues a start condition and sends address and transfer direction. </p>
<p>If device is busy, use ack polling to wait until device ready </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">addr</td><td>address and transfer direction of I2C device </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>none </dd></dl>
</div>
</div>
<a class="anchor" id="gadd947aade44ed6b7f92265f9dec4a711"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned char i2c_write </td>
<td>(</td>
<td class="paramtype">unsigned char </td>
<td class="paramname"><em>data</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Send one byte to I2C device. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">data</td><td>byte to be transfered </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">0</td><td>write successful </td></tr>
<tr><td class="paramname">1</td><td>write failed </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga32ac22052d55f93375b024192217db21"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned char i2c_readAck </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>read one byte from the I2C device, request more data from device </p>
<dl class="section return"><dt>Returns</dt><dd>byte read from I2C device </dd></dl>
</div>
</div>
<a class="anchor" id="gad89e839fc17b05fbb5dd79897c55234e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned char i2c_readNak </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>read one byte from the I2C device, read is followed by a stop condition </p>
<dl class="section return"><dt>Returns</dt><dd>byte read from I2C device </dd></dl>
</div>
</div>
<a class="anchor" id="ga669c0357614a79b3b35ae815f6f50e82"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned char i2c_read </td>
<td>(</td>
<td class="paramtype">unsigned char </td>
<td class="paramname"><em>ack</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>read one byte from the I2C device </p>
<p>Implemented as a macro, which calls either <a class="el" href="group__pfleury__ic2master.html#ga32ac22052d55f93375b024192217db21">i2c_readAck</a> or <a class="el" href="group__pfleury__ic2master.html#gad89e839fc17b05fbb5dd79897c55234e">i2c_readNak</a></p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ack</td><td>1 send ack, request more data from device<br />
0 send nak, read is followed by a stop condition </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>byte read from I2C device </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sat Jan 31 2015 21:02:51 for AVR-GCC Libraries by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>