1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00
arduinolibs/classSoftI2C.html
Rhys Weatherley bf683c08fb Update docs
2012-05-30 15:44:53 +10:00

294 lines
18 KiB
HTML

<!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"/>
<title>ArduinoLibs: SoftI2C Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">ArduinoLibs</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li id="searchli">
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> </div>
<div class="headertitle">
<div class="title">SoftI2C Class Reference</div> </div>
</div>
<div class="contents">
<!-- doxytag: class="SoftI2C" --><!-- doxytag: inherits="I2CMaster" -->
<p>Bit-banged implementation of an I2C master.
<a href="classSoftI2C.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="SoftI2C_8h_source.html">SoftI2C.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for SoftI2C:</div>
<div class="dyncontent">
<div class="center">
<img src="classSoftI2C.png" usemap="#SoftI2C_map" alt=""/>
<map id="SoftI2C_map" name="SoftI2C_map">
<area href="classI2CMaster.html" title="Abstract base class for I2C master implementations." alt="I2CMaster" shape="rect" coords="0,0,70,24"/>
</map>
</div></div>
<p><a href="classSoftI2C-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adb6e00ee3f930f1d32010a18feb5f6cc"></a><!-- doxytag: member="SoftI2C::SoftI2C" ref="adb6e00ee3f930f1d32010a18feb5f6cc" args="(uint8_t dataPin, uint8_t clockPin)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSoftI2C.html#adb6e00ee3f930f1d32010a18feb5f6cc">SoftI2C</a> (uint8_t dataPin, uint8_t clockPin)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a new software I2C master on <em>dataPin</em> and <em>clockPin</em>. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aad488669f28f6a5a4ceaae3de61d38f4"></a><!-- doxytag: member="SoftI2C::maxTransferSize" ref="aad488669f28f6a5a4ceaae3de61d38f4" args="() const " -->
unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSoftI2C.html#aad488669f28f6a5a4ceaae3de61d38f4">maxTransferSize</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the maximum number of bytes that can be read or written in a single request by this bus master. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSoftI2C.html#aa8a3219f4e6ff52306cc3c219f37d8f9">startWrite</a> (unsigned int address)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Starts a write operation by sending a start condition and the I2C control byte. <a href="#aa8a3219f4e6ff52306cc3c219f37d8f9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSoftI2C.html#ab46f0b6363c9cfe6fb3ab907956d5d73">write</a> (uint8_t value)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes a single byte <em>value</em> on the I2C bus. <a href="#ab46f0b6363c9cfe6fb3ab907956d5d73"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSoftI2C.html#aa12ae82813598b2e9ea70463c23c5bf3">endWrite</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Ends the current write operation. <a href="#aa12ae82813598b2e9ea70463c23c5bf3"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSoftI2C.html#aa0dafc067cfa374af75e060dca647ec3">startRead</a> (unsigned int address, unsigned int count)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Starts a read operation for <em>count</em> bytes by sending the start condition and the I2C control byte. <a href="#aa0dafc067cfa374af75e060dca647ec3"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSoftI2C.html#a849af91018caedbb82e83f02c543305e">available</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of bytes that are still available for reading. <a href="#a849af91018caedbb82e83f02c543305e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSoftI2C.html#a330dbba5b726fa161a6b01a9ca49e1bc">read</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads a single byte from the I2C bus. <a href="#a330dbba5b726fa161a6b01a9ca49e1bc"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Bit-banged implementation of an I2C master. </p>
<p>This class implements the I2C master protocol on any arbitrary pair of data and clock pins. It is not restricted to pre-defined pins as is the case for the standard Arduino two-wire interface.</p>
<p>This implementation only implements the master side of the protocol. It assumes that there is a single bus master, no arbitration, and no clock stretching.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classI2CMaster.html" title="Abstract base class for I2C master implementations.">I2CMaster</a> </dd></dl>
<p>Definition at line <a class="el" href="SoftI2C_8h_source.html#l00028">28</a> of file <a class="el" href="SoftI2C_8h_source.html">SoftI2C.h</a>.</p>
</div><hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a849af91018caedbb82e83f02c543305e"></a><!-- doxytag: member="SoftI2C::available" ref="a849af91018caedbb82e83f02c543305e" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned int SoftI2C::available </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the number of bytes that are still available for reading. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classSoftI2C.html#aa0dafc067cfa374af75e060dca647ec3" title="Starts a read operation for count bytes by sending the start condition and the I2C control byte...">startRead()</a>, <a class="el" href="classSoftI2C.html#a330dbba5b726fa161a6b01a9ca49e1bc" title="Reads a single byte from the I2C bus.">read()</a> </dd></dl>
<p>Implements <a class="el" href="classI2CMaster.html#a6458fa99cfd9e6270ae6dff993955833">I2CMaster</a>.</p>
<p>Definition at line <a class="el" href="SoftI2C_8cpp_source.html#l00155">155</a> of file <a class="el" href="SoftI2C_8cpp_source.html">SoftI2C.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="aa12ae82813598b2e9ea70463c23c5bf3"></a><!-- doxytag: member="SoftI2C::endWrite" ref="aa12ae82813598b2e9ea70463c23c5bf3" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool SoftI2C::endWrite </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Ends the current write operation. </p>
<p>Returns true if the write operation was acknowledged; false otherwise.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classSoftI2C.html#aa8a3219f4e6ff52306cc3c219f37d8f9" title="Starts a write operation by sending a start condition and the I2C control byte.">startWrite()</a>, <a class="el" href="classSoftI2C.html#ab46f0b6363c9cfe6fb3ab907956d5d73" title="Writes a single byte value on the I2C bus.">write()</a> </dd></dl>
<p>Implements <a class="el" href="classI2CMaster.html#ab29f63551ddeb032a91505d1c0b8ac41">I2CMaster</a>.</p>
<p>Definition at line <a class="el" href="SoftI2C_8cpp_source.html#l00129">129</a> of file <a class="el" href="SoftI2C_8cpp_source.html">SoftI2C.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a330dbba5b726fa161a6b01a9ca49e1bc"></a><!-- doxytag: member="SoftI2C::read" ref="a330dbba5b726fa161a6b01a9ca49e1bc" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t SoftI2C::read </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Reads a single byte from the I2C bus. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classSoftI2C.html#aa0dafc067cfa374af75e060dca647ec3" title="Starts a read operation for count bytes by sending the start condition and the I2C control byte...">startRead()</a>, <a class="el" href="classSoftI2C.html#a849af91018caedbb82e83f02c543305e" title="Returns the number of bytes that are still available for reading.">available()</a> </dd></dl>
<p>Implements <a class="el" href="classI2CMaster.html#a49eeebb57f6bc06de39973fe836369cd">I2CMaster</a>.</p>
<p>Definition at line <a class="el" href="SoftI2C_8cpp_source.html#l00160">160</a> of file <a class="el" href="SoftI2C_8cpp_source.html">SoftI2C.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="aa0dafc067cfa374af75e060dca647ec3"></a><!-- doxytag: member="SoftI2C::startRead" ref="aa0dafc067cfa374af75e060dca647ec3" args="(unsigned int address, unsigned int count)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool SoftI2C::startRead </td>
<td>(</td>
<td class="paramtype">unsigned int&#160;</td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int&#160;</td>
<td class="paramname"><em>count</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Starts a read operation for <em>count</em> bytes by sending the start condition and the I2C control byte. </p>
<p>The <em>address</em> must be the 7-bit or 10-bit address of the I2C slave on the bus.</p>
<p>Returns true if the read request was acknowledged by the I2C slave or false otherwise. If true, this function should be followed by <em>count</em> calls to <a class="el" href="classSoftI2C.html#a330dbba5b726fa161a6b01a9ca49e1bc" title="Reads a single byte from the I2C bus.">read()</a> to fetch the bytes.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classSoftI2C.html#a849af91018caedbb82e83f02c543305e" title="Returns the number of bytes that are still available for reading.">available()</a>, <a class="el" href="classSoftI2C.html#a330dbba5b726fa161a6b01a9ca49e1bc" title="Reads a single byte from the I2C bus.">read()</a>, <a class="el" href="classSoftI2C.html#aa8a3219f4e6ff52306cc3c219f37d8f9" title="Starts a write operation by sending a start condition and the I2C control byte.">startWrite()</a> </dd></dl>
<p>Implements <a class="el" href="classI2CMaster.html#a4e5f1a1a4c2242699be5a35fc4872fde">I2CMaster</a>.</p>
<p>Definition at line <a class="el" href="SoftI2C_8cpp_source.html#l00135">135</a> of file <a class="el" href="SoftI2C_8cpp_source.html">SoftI2C.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="aa8a3219f4e6ff52306cc3c219f37d8f9"></a><!-- doxytag: member="SoftI2C::startWrite" ref="aa8a3219f4e6ff52306cc3c219f37d8f9" args="(unsigned int address)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void SoftI2C::startWrite </td>
<td>(</td>
<td class="paramtype">unsigned int&#160;</td>
<td class="paramname"><em>address</em></td><td>)</td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Starts a write operation by sending a start condition and the I2C control byte. </p>
<p>The <em>address</em> must be the 7-bit or 10-bit address of the I2C slave on the bus.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classSoftI2C.html#ab46f0b6363c9cfe6fb3ab907956d5d73" title="Writes a single byte value on the I2C bus.">write()</a>, <a class="el" href="classSoftI2C.html#aa12ae82813598b2e9ea70463c23c5bf3" title="Ends the current write operation.">endWrite()</a>, <a class="el" href="classSoftI2C.html#aa0dafc067cfa374af75e060dca647ec3" title="Starts a read operation for count bytes by sending the start condition and the I2C control byte...">startRead()</a> </dd></dl>
<p>Reimplemented from <a class="el" href="classI2CMaster.html#a01960fc821cb25e4c88c26d2c6107e35">I2CMaster</a>.</p>
<p>Definition at line <a class="el" href="SoftI2C_8cpp_source.html#l00104">104</a> of file <a class="el" href="SoftI2C_8cpp_source.html">SoftI2C.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="ab46f0b6363c9cfe6fb3ab907956d5d73"></a><!-- doxytag: member="SoftI2C::write" ref="ab46f0b6363c9cfe6fb3ab907956d5d73" args="(uint8_t value)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void SoftI2C::write </td>
<td>(</td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>value</em></td><td>)</td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Writes a single byte <em>value</em> on the I2C bus. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classSoftI2C.html#aa8a3219f4e6ff52306cc3c219f37d8f9" title="Starts a write operation by sending a start condition and the I2C control byte.">startWrite()</a>, <a class="el" href="classSoftI2C.html#aa12ae82813598b2e9ea70463c23c5bf3" title="Ends the current write operation.">endWrite()</a> </dd></dl>
<p>Implements <a class="el" href="classI2CMaster.html#a0bf6b84cb1e2b3a37a4a0260d0b6f960">I2CMaster</a>.</p>
<p>Definition at line <a class="el" href="SoftI2C_8cpp_source.html#l00118">118</a> of file <a class="el" href="SoftI2C_8cpp_source.html">SoftI2C.cpp</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="SoftI2C_8h_source.html">SoftI2C.h</a></li>
<li><a class="el" href="SoftI2C_8cpp_source.html">SoftI2C.cpp</a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Wed May 30 2012 15:44:35 for ArduinoLibs by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>