This repository has been archived on 2020-09-09. You can view files and clone it, but cannot push or open issues or pull requests.
arduino_universal_serial_ad.../Libraries/SerialPort/html/a00002.html

423 lines
20 KiB
HTML
Raw Permalink Normal View History

<!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>Serial Port: SerialRingBuffer 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">Serial Port</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 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="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> </div>
<div class="headertitle">
<div class="title">SerialRingBuffer Class Reference</div> </div>
</div>
<div class="contents">
<!-- doxytag: class="SerialRingBuffer" -->
<p>Ring buffer for RX and TX data.
<a href="a00002.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="a00005_source.html">SerialPort.h</a>&gt;</code></p>
<p><a href="a00010.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">buf_size_t</a></td></tr>
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#a6ddd7ba8df8faf8d2ad4f531598ce0ef">available</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#a59e5d391e818cabc7825e9ed1fbdf1d4">empty</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#aced2c894d319649da813ec2793b0e1ef">flush</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#a8311099fd2c67ec9e8359f69bac74494">get</a> (uint8_t *b)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">buf_size_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#a9c2302901a640aa1beae617648736719">get</a> (uint8_t *b, <a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">buf_size_t</a> n)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#a685b9bf8f88ae50a19cfa966536013ca">init</a> (uint8_t *b, <a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">buf_size_t</a> s)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#a46f0f82e9272c91b8142ef866e630347">peek</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#a8f1b71cc976869c4793d0c7cafb4a2d0">put</a> (uint8_t b)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">buf_size_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#ae99d2ec6f7ed07faf71ee5d87fbc9da3">put</a> (const uint8_t *b, <a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">buf_size_t</a> n)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">buf_size_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#ad358c07849edc45194672af52ba36b6e">put_P</a> (PGM_P b, <a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">buf_size_t</a> n)</td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Ring buffer for RX and TX data. </p>
<p>Definition at line <a class="el" href="a00005_source.html#l00246">246</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
</div><hr/><h2>Member Typedef Documentation</h2>
<a class="anchor" id="ac7bbaea80ad0ee33dbb5223d240784c9"></a><!-- doxytag: member="SerialRingBuffer::buf_size_t" ref="ac7bbaea80ad0ee33dbb5223d240784c9" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef uint16_t <a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">SerialRingBuffer::buf_size_t</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Define type for buffer indices </p>
<p>Definition at line <a class="el" href="a00005_source.html#l00250">250</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a6ddd7ba8df8faf8d2ad4f531598ce0ef"></a><!-- doxytag: member="SerialRingBuffer::available" ref="a6ddd7ba8df8faf8d2ad4f531598ce0ef" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int SerialRingBuffer::available </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes in the ring buffer.</dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>This function must not be called with interrupts disabled. </dd></dl>
<p>Definition at line <a class="el" href="a00004_source.html#l00030">30</a> of file <a class="el" href="a00004_source.html">SerialPort.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a59e5d391e818cabc7825e9ed1fbdf1d4"></a><!-- doxytag: member="SerialRingBuffer::empty" ref="a59e5d391e818cabc7825e9ed1fbdf1d4" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool SerialRingBuffer::empty </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl class="return"><dt><b>Returns:</b></dt><dd><code>true</code> if the ring buffer is empty else <code>false</code>. </dd></dl>
<p>Definition at line <a class="el" href="a00005_source.html#l00256">256</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
</div>
</div>
<a class="anchor" id="aced2c894d319649da813ec2793b0e1ef"></a><!-- doxytag: member="SerialRingBuffer::flush" ref="aced2c894d319649da813ec2793b0e1ef" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void SerialRingBuffer::flush </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Discard all data in the ring buffer.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>This function must not be called with interrupts disabled. </dd></dl>
<p>Definition at line <a class="el" href="a00004_source.html#l00042">42</a> of file <a class="el" href="a00004_source.html">SerialPort.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a8311099fd2c67ec9e8359f69bac74494"></a><!-- doxytag: member="SerialRingBuffer::get" ref="a8311099fd2c67ec9e8359f69bac74494" args="(uint8_t *b)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool SerialRingBuffer::get </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>b</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Get the next byte from the ring buffer.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">b</td><td>location for the returned byte </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>true</code> if a byte was returned or <code>false</code> if the ring buffer is empty </dd></dl>
<p>Definition at line <a class="el" href="a00004_source.html#l00054">54</a> of file <a class="el" href="a00004_source.html">SerialPort.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a9c2302901a640aa1beae617648736719"></a><!-- doxytag: member="SerialRingBuffer::get" ref="a9c2302901a640aa1beae617648736719" args="(uint8_t *b, buf_size_t n)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">SerialRingBuffer::buf_size_t</a> SerialRingBuffer::get </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>b</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">buf_size_t</a>&#160;</td>
<td class="paramname"><em>n</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Get the maximum number of contiguous bytes from the ring buffer with one call to memcpy.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>This function must not be called with interrupts disabled.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">b</td><td>Pointer to the data. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">n</td><td>Number of bytes to transfer from the ring buffer. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Number of bytes transferred. </dd></dl>
<p>Definition at line <a class="el" href="a00004_source.html#l00072">72</a> of file <a class="el" href="a00004_source.html">SerialPort.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a685b9bf8f88ae50a19cfa966536013ca"></a><!-- doxytag: member="SerialRingBuffer::init" ref="a685b9bf8f88ae50a19cfa966536013ca" args="(uint8_t *b, buf_size_t s)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void SerialRingBuffer::init </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>b</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">buf_size_t</a>&#160;</td>
<td class="paramname"><em>s</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initialize the ring buffer. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">b</td><td>Buffer for the data. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">s</td><td>Size of the buffer. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="a00004_source.html#l00096">96</a> of file <a class="el" href="a00004_source.html">SerialPort.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a46f0f82e9272c91b8142ef866e630347"></a><!-- doxytag: member="SerialRingBuffer::peek" ref="a46f0f82e9272c91b8142ef866e630347" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int SerialRingBuffer::peek </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Peek at the next byte in the ring buffer. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>The next byte that would be read or -1 if the ring buffer is empty. </dd></dl>
<p>Definition at line <a class="el" href="a00004_source.html#l00105">105</a> of file <a class="el" href="a00004_source.html">SerialPort.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a8f1b71cc976869c4793d0c7cafb4a2d0"></a><!-- doxytag: member="SerialRingBuffer::put" ref="a8f1b71cc976869c4793d0c7cafb4a2d0" args="(uint8_t b)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool SerialRingBuffer::put </td>
<td>(</td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>b</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Put a byte into the ring buffer.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">b</td><td>the byte </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>true</code> if byte was transferred or <code>false</code> if the ring buffer is full. </dd></dl>
<p>Definition at line <a class="el" href="a00004_source.html#l00115">115</a> of file <a class="el" href="a00004_source.html">SerialPort.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="ae99d2ec6f7ed07faf71ee5d87fbc9da3"></a><!-- doxytag: member="SerialRingBuffer::put" ref="ae99d2ec6f7ed07faf71ee5d87fbc9da3" args="(const uint8_t *b, buf_size_t n)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">SerialRingBuffer::buf_size_t</a> SerialRingBuffer::put </td>
<td>(</td>
<td class="paramtype">const uint8_t *&#160;</td>
<td class="paramname"><em>b</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">buf_size_t</a>&#160;</td>
<td class="paramname"><em>n</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Put the maximum number of contiguous bytes into the ring buffer. with one call to memcpy.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>This function must not be called with interrupts disabled.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">b</td><td>pointer to data. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">n</td><td>number of bytes to transfer to the ring buffer. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>number of bytes transferred. </dd></dl>
<p>Definition at line <a class="el" href="a00004_source.html#l00136">136</a> of file <a class="el" href="a00004_source.html">SerialPort.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="ad358c07849edc45194672af52ba36b6e"></a><!-- doxytag: member="SerialRingBuffer::put_P" ref="ad358c07849edc45194672af52ba36b6e" args="(PGM_P b, buf_size_t n)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">SerialRingBuffer::buf_size_t</a> SerialRingBuffer::put_P </td>
<td>(</td>
<td class="paramtype">PGM_P&#160;</td>
<td class="paramname"><em>b</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00002.html#ac7bbaea80ad0ee33dbb5223d240784c9">buf_size_t</a>&#160;</td>
<td class="paramname"><em>n</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Put the maximum number of contiguous bytes into the ring buffer. with one call to memcpy.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>This function must not be called with interrupts disabled.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">b</td><td>pointer to data. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">n</td><td>number of bytes to transfer to the ring buffer. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>number of bytes transferred. </dd></dl>
<p>Definition at line <a class="el" href="a00004_source.html#l00165">165</a> of file <a class="el" href="a00004_source.html">SerialPort.cpp</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>Arduino/libraries/SerialPort/<a class="el" href="a00005_source.html">SerialPort.h</a></li>
<li>Arduino/libraries/SerialPort/<a class="el" href="a00004_source.html">SerialPort.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>Defines</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 Fri Feb 22 2013 11:38:19 for Serial Port 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>