mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
263 lines
24 KiB
HTML
263 lines
24 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: EEPROM24.cpp Source File</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 Page</span></a></li>
|
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
|
<li><a href="modules.html"><span>Modules</span></a></li>
|
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
|
<li class="current"><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="files.html"><span>File List</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">EEPROM24.cpp</div> </div>
|
|
</div>
|
|
<div class="contents">
|
|
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
|
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2012 Southern Storm Software, Pty Ltd.</span>
|
|
<a name="l00003"></a>00003 <span class="comment"> *</span>
|
|
<a name="l00004"></a>00004 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a</span>
|
|
<a name="l00005"></a>00005 <span class="comment"> * copy of this software and associated documentation files (the "Software"),</span>
|
|
<a name="l00006"></a>00006 <span class="comment"> * to deal in the Software without restriction, including without limitation</span>
|
|
<a name="l00007"></a>00007 <span class="comment"> * the rights to use, copy, modify, merge, publish, distribute, sublicense,</span>
|
|
<a name="l00008"></a>00008 <span class="comment"> * and/or sell copies of the Software, and to permit persons to whom the</span>
|
|
<a name="l00009"></a>00009 <span class="comment"> * Software is furnished to do so, subject to the following conditions:</span>
|
|
<a name="l00010"></a>00010 <span class="comment"> *</span>
|
|
<a name="l00011"></a>00011 <span class="comment"> * The above copyright notice and this permission notice shall be included</span>
|
|
<a name="l00012"></a>00012 <span class="comment"> * in all copies or substantial portions of the Software.</span>
|
|
<a name="l00013"></a>00013 <span class="comment"> *</span>
|
|
<a name="l00014"></a>00014 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS</span>
|
|
<a name="l00015"></a>00015 <span class="comment"> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span>
|
|
<a name="l00016"></a>00016 <span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span>
|
|
<a name="l00017"></a>00017 <span class="comment"> * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span>
|
|
<a name="l00018"></a>00018 <span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</span>
|
|
<a name="l00019"></a>00019 <span class="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</span>
|
|
<a name="l00020"></a>00020 <span class="comment"> * DEALINGS IN THE SOFTWARE.</span>
|
|
<a name="l00021"></a>00021 <span class="comment"> */</span>
|
|
<a name="l00022"></a>00022
|
|
<a name="l00023"></a>00023 <span class="preprocessor">#include "EEPROM24.h"</span>
|
|
<a name="l00024"></a>00024 <span class="preprocessor">#include "I2CMaster.h"</span>
|
|
<a name="l00025"></a>00025
|
|
<a name="l00095"></a><a class="code" href="classEEPROM24.html#ae8547f6ff7711496e1959ee24a142995">00095</a> <a class="code" href="classEEPROM24.html#ae8547f6ff7711496e1959ee24a142995" title="Constructs a new EEPROM access object on bus for an EEPROM of the specified type.">EEPROM24::EEPROM24</a>(<a class="code" href="classI2CMaster.html" title="Abstract base class for I2C master implementations.">I2CMaster</a> &bus, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> type, uint8_t bank)
|
|
<a name="l00096"></a>00096 : _bus(&bus)
|
|
<a name="l00097"></a>00097 , _size((type & 0xFFFF) * ((type >> 16) & 0x0FFF))
|
|
<a name="l00098"></a>00098 , _pageSize((type >> 16) & 0x0FFF)
|
|
<a name="l00099"></a>00099 , _mode((uint8_t)((type >> 28) & 0x0F))
|
|
<a name="l00100"></a>00100 , i2cAddress(0x50)
|
|
<a name="l00101"></a>00101 {
|
|
<a name="l00102"></a>00102 <span class="comment">// Adjust the I2C address for the memory bank of the chip.</span>
|
|
<a name="l00103"></a>00103 <span class="keywordflow">switch</span> (_mode) {
|
|
<a name="l00104"></a>00104 <span class="keywordflow">case</span> EE_BSEL_NONE:
|
|
<a name="l00105"></a>00105 i2cAddress += (bank & 0x07);
|
|
<a name="l00106"></a>00106 <span class="keywordflow">break</span>;
|
|
<a name="l00107"></a>00107 <span class="keywordflow">case</span> EE_BSEL_8BIT_ADDR: {
|
|
<a name="l00108"></a>00108 uint8_t addrBits = 8;
|
|
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classEEPROM24.html#aa544875cef9bd05bf71d6c19be06cf7c" title="Returns the size of the EEPROM in bytes.">size</a> = 0x0100;
|
|
<a name="l00110"></a>00110 <span class="keywordflow">while</span> (size < _size) {
|
|
<a name="l00111"></a>00111 ++addrBits;
|
|
<a name="l00112"></a>00112 size <<= 1;
|
|
<a name="l00113"></a>00113 }
|
|
<a name="l00114"></a>00114 <span class="keywordflow">if</span> (addrBits < 11)
|
|
<a name="l00115"></a>00115 i2cAddress += ((bank << (addrBits - 8)) & 0x07);
|
|
<a name="l00116"></a>00116 <span class="keywordflow">break</span>; }
|
|
<a name="l00117"></a>00117 <span class="keywordflow">case</span> EE_BSEL_17BIT_ADDR:
|
|
<a name="l00118"></a>00118 i2cAddress += ((bank << 1) & 0x06);
|
|
<a name="l00119"></a>00119 <span class="keywordflow">break</span>;
|
|
<a name="l00120"></a>00120 <span class="keywordflow">case</span> EE_BSEL_17BIT_ADDR_ALT:
|
|
<a name="l00121"></a>00121 i2cAddress += bank & 0x03;
|
|
<a name="l00122"></a>00122 <span class="keywordflow">break</span>;
|
|
<a name="l00123"></a>00123 }
|
|
<a name="l00124"></a>00124 }
|
|
<a name="l00125"></a>00125
|
|
<a name="l00152"></a><a class="code" href="classEEPROM24.html#af8b70971d882b06de3fc6644a8ece3cf">00152</a> <span class="keywordtype">bool</span> <a class="code" href="classEEPROM24.html#af8b70971d882b06de3fc6644a8ece3cf" title="Returns true if the EEPROM is available on the I2C bus; false otherwise.">EEPROM24::available</a>()
|
|
<a name="l00153"></a>00153 {
|
|
<a name="l00154"></a>00154 <span class="comment">// Perform a "Current Address Read" on the EEPROM. We don't care about</span>
|
|
<a name="l00155"></a>00155 <span class="comment">// the returned byte. We only care if the read request was ACK'ed or not.</span>
|
|
<a name="l00156"></a>00156 <span class="keywordflow">if</span> (!_bus-><a class="code" href="classI2CMaster.html#a4e5f1a1a4c2242699be5a35fc4872fde" title="Starts a read operation for count bytes by sending the start condition and the I2C control byte...">startRead</a>(i2cAddress, 1))
|
|
<a name="l00157"></a>00157 <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
|
<a name="l00158"></a>00158 _bus-><a class="code" href="classI2CMaster.html#a49eeebb57f6bc06de39973fe836369cd" title="Reads a single byte from the I2C bus.">read</a>();
|
|
<a name="l00159"></a>00159 <span class="keywordflow">return</span> <span class="keyword">true</span>;
|
|
<a name="l00160"></a>00160 }
|
|
<a name="l00161"></a>00161
|
|
<a name="l00167"></a><a class="code" href="classEEPROM24.html#a960971377d4decb122ff38d12603e586">00167</a> uint8_t <a class="code" href="classEEPROM24.html#a960971377d4decb122ff38d12603e586" title="Reads a single byte from the EEPROM at address.">EEPROM24::read</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> address)
|
|
<a name="l00168"></a>00168 {
|
|
<a name="l00169"></a>00169 <span class="keywordflow">if</span> (address >= _size)
|
|
<a name="l00170"></a>00170 <span class="keywordflow">return</span> 0;
|
|
<a name="l00171"></a>00171 writeAddress(address);
|
|
<a name="l00172"></a>00172 <span class="keywordflow">if</span> (!_bus-><a class="code" href="classI2CMaster.html#a4e5f1a1a4c2242699be5a35fc4872fde" title="Starts a read operation for count bytes by sending the start condition and the I2C control byte...">startRead</a>(i2cAddress, 1))
|
|
<a name="l00173"></a>00173 <span class="keywordflow">return</span> 0;
|
|
<a name="l00174"></a>00174 <span class="keywordflow">return</span> _bus-><a class="code" href="classI2CMaster.html#a49eeebb57f6bc06de39973fe836369cd" title="Reads a single byte from the I2C bus.">read</a>();
|
|
<a name="l00175"></a>00175 }
|
|
<a name="l00176"></a>00176
|
|
<a name="l00187"></a><a class="code" href="classEEPROM24.html#a63e23dc014415f947975359ac09f627e">00187</a> <span class="keywordtype">size_t</span> <a class="code" href="classEEPROM24.html#a960971377d4decb122ff38d12603e586" title="Reads a single byte from the EEPROM at address.">EEPROM24::read</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> address, <span class="keywordtype">void</span> *data, <span class="keywordtype">size_t</span> length)
|
|
<a name="l00188"></a>00188 {
|
|
<a name="l00189"></a>00189 <span class="keywordflow">if</span> (address >= _size || !length)
|
|
<a name="l00190"></a>00190 <span class="keywordflow">return</span> 0;
|
|
<a name="l00191"></a>00191 <span class="keywordflow">if</span> ((address + length) > _size)
|
|
<a name="l00192"></a>00192 length = (size_t)(_size - address);
|
|
<a name="l00193"></a>00193 writeAddress(address);
|
|
<a name="l00194"></a>00194 <span class="keywordflow">if</span> (!_bus-><a class="code" href="classI2CMaster.html#a4e5f1a1a4c2242699be5a35fc4872fde" title="Starts a read operation for count bytes by sending the start condition and the I2C control byte...">startRead</a>(i2cAddress, length))
|
|
<a name="l00195"></a>00195 <span class="keywordflow">return</span> 0;
|
|
<a name="l00196"></a>00196 uint8_t *d = (uint8_t *)data;
|
|
<a name="l00197"></a>00197 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> count = 0;
|
|
<a name="l00198"></a>00198 <span class="keywordflow">while</span> (_bus-><a class="code" href="classI2CMaster.html#a6458fa99cfd9e6270ae6dff993955833" title="Returns the number of bytes that are still available for reading.">available</a>()) {
|
|
<a name="l00199"></a>00199 *d++ = _bus-><a class="code" href="classI2CMaster.html#a49eeebb57f6bc06de39973fe836369cd" title="Reads a single byte from the I2C bus.">read</a>();
|
|
<a name="l00200"></a>00200 ++count;
|
|
<a name="l00201"></a>00201 }
|
|
<a name="l00202"></a>00202 <span class="keywordflow">return</span> count;
|
|
<a name="l00203"></a>00203 }
|
|
<a name="l00204"></a>00204
|
|
<a name="l00213"></a><a class="code" href="classEEPROM24.html#a9e017772e3459ee4ab987e27d78937f8">00213</a> <span class="keywordtype">bool</span> <a class="code" href="classEEPROM24.html#a9e017772e3459ee4ab987e27d78937f8" title="Writes a byte value to address in the EEPROM.">EEPROM24::write</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> address, uint8_t value)
|
|
<a name="l00214"></a>00214 {
|
|
<a name="l00215"></a>00215 <span class="keywordflow">if</span> (address >= _size)
|
|
<a name="l00216"></a>00216 <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
|
<a name="l00217"></a>00217 writeAddress(address);
|
|
<a name="l00218"></a>00218 _bus-><a class="code" href="classI2CMaster.html#a0bf6b84cb1e2b3a37a4a0260d0b6f960" title="Writes a single byte value on the I2C bus.">write</a>(value);
|
|
<a name="l00219"></a>00219 <span class="keywordflow">return</span> waitForWrite();
|
|
<a name="l00220"></a>00220 }
|
|
<a name="l00221"></a>00221
|
|
<a name="l00235"></a><a class="code" href="classEEPROM24.html#a3d918ed34da7ca6d21a776c0614eebf3">00235</a> <span class="keywordtype">size_t</span> <a class="code" href="classEEPROM24.html#a9e017772e3459ee4ab987e27d78937f8" title="Writes a byte value to address in the EEPROM.">EEPROM24::write</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> address, <span class="keyword">const</span> <span class="keywordtype">void</span> *data, <span class="keywordtype">size_t</span> length)
|
|
<a name="l00236"></a>00236 {
|
|
<a name="l00237"></a>00237 <span class="keywordflow">if</span> (address >= _size)
|
|
<a name="l00238"></a>00238 <span class="keywordflow">return</span> 0;
|
|
<a name="l00239"></a>00239 <span class="keywordflow">if</span> ((address + length) > _size)
|
|
<a name="l00240"></a>00240 length = (size_t)(_size - address);
|
|
<a name="l00241"></a>00241 <span class="keywordtype">bool</span> needAddress = <span class="keyword">true</span>;
|
|
<a name="l00242"></a>00242 <span class="keywordtype">size_t</span> result = 0;
|
|
<a name="l00243"></a>00243 <span class="keywordtype">size_t</span> page = 0;
|
|
<a name="l00244"></a>00244 <span class="keyword">const</span> uint8_t *d = (<span class="keyword">const</span> uint8_t *)data;
|
|
<a name="l00245"></a>00245 <span class="keywordflow">while</span> (length > 0) {
|
|
<a name="l00246"></a>00246 <span class="keywordflow">if</span> (needAddress) {
|
|
<a name="l00247"></a>00247 writeAddress(address);
|
|
<a name="l00248"></a>00248 needAddress = <span class="keyword">false</span>;
|
|
<a name="l00249"></a>00249 }
|
|
<a name="l00250"></a>00250 _bus-><a class="code" href="classI2CMaster.html#a0bf6b84cb1e2b3a37a4a0260d0b6f960" title="Writes a single byte value on the I2C bus.">write</a>(*d++);
|
|
<a name="l00251"></a>00251 ++address;
|
|
<a name="l00252"></a>00252 ++page;
|
|
<a name="l00253"></a>00253 <span class="keywordflow">if</span> ((address & (_pageSize - 1)) == 0) {
|
|
<a name="l00254"></a>00254 <span class="comment">// At the end of a page, so perform a flush.</span>
|
|
<a name="l00255"></a>00255 <span class="keywordflow">if</span> (!waitForWrite())
|
|
<a name="l00256"></a>00256 <span class="keywordflow">return</span> result; <span class="comment">// Could not write this page.</span>
|
|
<a name="l00257"></a>00257 needAddress = <span class="keyword">true</span>;
|
|
<a name="l00258"></a>00258 result += page;
|
|
<a name="l00259"></a>00259 page = 0;
|
|
<a name="l00260"></a>00260 }
|
|
<a name="l00261"></a>00261 --length;
|
|
<a name="l00262"></a>00262 }
|
|
<a name="l00263"></a>00263 <span class="keywordflow">if</span> (!needAddress) {
|
|
<a name="l00264"></a>00264 <span class="keywordflow">if</span> (!waitForWrite())
|
|
<a name="l00265"></a>00265 <span class="keywordflow">return</span> result; <span class="comment">// Could not write the final page.</span>
|
|
<a name="l00266"></a>00266 }
|
|
<a name="l00267"></a>00267 <span class="keywordflow">return</span> result + page;
|
|
<a name="l00268"></a>00268 }
|
|
<a name="l00269"></a>00269
|
|
<a name="l00270"></a>00270 <span class="keywordtype">void</span> EEPROM24::writeAddress(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> address)
|
|
<a name="l00271"></a>00271 {
|
|
<a name="l00272"></a>00272 <span class="keywordflow">switch</span> (_mode) {
|
|
<a name="l00273"></a>00273 <span class="keywordflow">case</span> EE_BSEL_NONE:
|
|
<a name="l00274"></a>00274 _bus-><a class="code" href="classI2CMaster.html#a01960fc821cb25e4c88c26d2c6107e35" title="Starts a write operation by sending a start condition and the I2C control byte.">startWrite</a>(i2cAddress);
|
|
<a name="l00275"></a>00275 _bus-><a class="code" href="classI2CMaster.html#a0bf6b84cb1e2b3a37a4a0260d0b6f960" title="Writes a single byte value on the I2C bus.">write</a>((uint8_t)(address >> 8));
|
|
<a name="l00276"></a>00276 _bus-><a class="code" href="classI2CMaster.html#a0bf6b84cb1e2b3a37a4a0260d0b6f960" title="Writes a single byte value on the I2C bus.">write</a>((uint8_t)address);
|
|
<a name="l00277"></a>00277 <span class="keywordflow">break</span>;
|
|
<a name="l00278"></a>00278 <span class="keywordflow">case</span> EE_BSEL_8BIT_ADDR:
|
|
<a name="l00279"></a>00279 _bus-><a class="code" href="classI2CMaster.html#a01960fc821cb25e4c88c26d2c6107e35" title="Starts a write operation by sending a start condition and the I2C control byte.">startWrite</a>(i2cAddress | (((uint8_t)(address >> 8)) & 0x07));
|
|
<a name="l00280"></a>00280 _bus-><a class="code" href="classI2CMaster.html#a0bf6b84cb1e2b3a37a4a0260d0b6f960" title="Writes a single byte value on the I2C bus.">write</a>((uint8_t)address);
|
|
<a name="l00281"></a>00281 <span class="keywordflow">break</span>;
|
|
<a name="l00282"></a>00282 <span class="keywordflow">case</span> EE_BSEL_17BIT_ADDR:
|
|
<a name="l00283"></a>00283 _bus-><a class="code" href="classI2CMaster.html#a01960fc821cb25e4c88c26d2c6107e35" title="Starts a write operation by sending a start condition and the I2C control byte.">startWrite</a>(i2cAddress | (((uint8_t)(address >> 16)) & 0x01));
|
|
<a name="l00284"></a>00284 _bus-><a class="code" href="classI2CMaster.html#a0bf6b84cb1e2b3a37a4a0260d0b6f960" title="Writes a single byte value on the I2C bus.">write</a>((uint8_t)(address >> 8));
|
|
<a name="l00285"></a>00285 _bus-><a class="code" href="classI2CMaster.html#a0bf6b84cb1e2b3a37a4a0260d0b6f960" title="Writes a single byte value on the I2C bus.">write</a>((uint8_t)address);
|
|
<a name="l00286"></a>00286 <span class="keywordflow">break</span>;
|
|
<a name="l00287"></a>00287 <span class="keywordflow">case</span> EE_BSEL_17BIT_ADDR_ALT:
|
|
<a name="l00288"></a>00288 _bus-><a class="code" href="classI2CMaster.html#a01960fc821cb25e4c88c26d2c6107e35" title="Starts a write operation by sending a start condition and the I2C control byte.">startWrite</a>(i2cAddress | (((uint8_t)(address >> 14)) & 0x04));
|
|
<a name="l00289"></a>00289 _bus-><a class="code" href="classI2CMaster.html#a0bf6b84cb1e2b3a37a4a0260d0b6f960" title="Writes a single byte value on the I2C bus.">write</a>((uint8_t)(address >> 8));
|
|
<a name="l00290"></a>00290 _bus-><a class="code" href="classI2CMaster.html#a0bf6b84cb1e2b3a37a4a0260d0b6f960" title="Writes a single byte value on the I2C bus.">write</a>((uint8_t)address);
|
|
<a name="l00291"></a>00291 <span class="keywordflow">break</span>;
|
|
<a name="l00292"></a>00292 }
|
|
<a name="l00293"></a>00293 }
|
|
<a name="l00294"></a>00294
|
|
<a name="l00295"></a>00295 <span class="keywordtype">bool</span> EEPROM24::waitForWrite()
|
|
<a name="l00296"></a>00296 {
|
|
<a name="l00297"></a>00297 <span class="comment">// 1000 iterations is going to be approximately 100ms when the I2C</span>
|
|
<a name="l00298"></a>00298 <span class="comment">// clock is 100 kHz. If there has been no response in that time</span>
|
|
<a name="l00299"></a>00299 <span class="comment">// then we assume that the write has failed and timeout.</span>
|
|
<a name="l00300"></a>00300 <span class="keywordflow">if</span> (!_bus-><a class="code" href="classI2CMaster.html#ab29f63551ddeb032a91505d1c0b8ac41" title="Ends the current write operation.">endWrite</a>())
|
|
<a name="l00301"></a>00301 <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
|
<a name="l00302"></a>00302 <span class="keywordtype">unsigned</span> count = 1000;
|
|
<a name="l00303"></a>00303 <span class="keywordflow">while</span> (count > 0) {
|
|
<a name="l00304"></a>00304 _bus-><a class="code" href="classI2CMaster.html#a01960fc821cb25e4c88c26d2c6107e35" title="Starts a write operation by sending a start condition and the I2C control byte.">startWrite</a>(i2cAddress);
|
|
<a name="l00305"></a>00305 <span class="keywordflow">if</span> (_bus-><a class="code" href="classI2CMaster.html#ab29f63551ddeb032a91505d1c0b8ac41" title="Ends the current write operation.">endWrite</a>())
|
|
<a name="l00306"></a>00306 <span class="keywordflow">return</span> <span class="keyword">true</span>;
|
|
<a name="l00307"></a>00307 --count;
|
|
<a name="l00308"></a>00308 }
|
|
<a name="l00309"></a>00309 <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
|
<a name="l00310"></a>00310 }
|
|
</pre></div></div>
|
|
</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"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </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 Mon Jun 18 2012 11:02:51 for ArduinoLibs by 
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
|
|
</body>
|
|
</html>
|