123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384 |
- <!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>
|