685 lines
33 KiB
HTML
685 lines
33 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>Serial Port: SerialPort< PortNumber, RxBufSize, TxBufSize > Class Template 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 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 List</span></a></li>
|
|
<li><a href="functions.html"><span>Class 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">SerialPort< PortNumber, RxBufSize, TxBufSize > Class Template Reference</div> </div>
|
|
</div>
|
|
<div class="contents">
|
|
<!-- doxytag: class="SerialPort" -->
|
|
<p>Class for avr hardware USART ports.
|
|
<a href="a00001.html#details">More...</a></p>
|
|
|
|
<p><code>#include <<a class="el" href="a00005_source.html">SerialPort.h</a>></code></p>
|
|
|
|
<p><a href="a00009.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"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#a33b60beed8333ea6902da22bcbfa8ef9">SerialPort</a> ()</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#af1024de6e41a21d1f362fedae73a2b39">available</a> (void)</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#a38b8cda8cb7c94a38de9f29ee48f4259">begin</a> (uint32_t baud, uint8_t options=<a class="el" href="a00005.html#aaacdef21e05f2054cef451d4f840317b">SP_8_BIT_CHAR</a>)</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#a1de98218b494b92e683624aed3363386">clearRxError</a> ()</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#a2f3d7c793365fcd861d3cce795d986f8">end</a> ()</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#a980a0188ad3ad64df2814462a5ebc707">flush</a> ()</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#ad2757ef24789a658405832447ae66bf5">flushRx</a> ()</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#abb49b6680762ee9b87fc9b0c578fb878">flushTx</a> ()</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#a1987a9d938995932929830be0adf4bf6">getRxError</a> ()</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#aa467bbb3efb104c8f52cba13ef3b30a0">peek</a> (void)</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#a6f20328c42db732c9243ce3a90d1e029">read</a> ()</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#acb3106febfe5e47077bfa3439b4631c0">read</a> (uint8_t *b, size_t n)</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#aae0a527e45a020a56fb3ec50bc7dee3b">write</a> (const char *s)</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#a47aa3f8bdc6709e92275ac7d26e8cdb2">write</a> (uint8_t b)</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#a63bb0a672b9bbe05d798379e3cfb57b3">write</a> (const __FlashStringHelper *s)</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#ae56f856288b08e2b7304a79f62081947">write</a> (const uint8_t *b, size_t n)</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#a3e1d910680b806a12b8505c8f20d0a76">write_P</a> (PGM_P b, size_t n)</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#a44c4ee83aa047ba1c458ca0969a9bf47">writeln</a> (const char *s)</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#a903a10dc74404eda0ec8ae8b7eac93c2">writeln</a> ()</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html#ae783622f9524b84c547577dff64a3d73">writeln</a> (const __FlashStringHelper *s)</td></tr>
|
|
</table>
|
|
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
|
|
<div class="textblock"><h3>template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize><br/>
|
|
class SerialPort< PortNumber, RxBufSize, TxBufSize ></h3>
|
|
|
|
<p>Class for avr hardware USART ports. </p>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00300">300</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
</div><hr/><h2>Constructor & Destructor Documentation</h2>
|
|
<a class="anchor" id="a33b60beed8333ea6902da22bcbfa8ef9"></a><!-- doxytag: member="SerialPort::SerialPort" ref="a33b60beed8333ea6902da22bcbfa8ef9" args="()" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::<a class="el" href="a00001.html">SerialPort</a> </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Constructor </p>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00304">304</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="af1024de6e41a21d1f362fedae73a2b39"></a><!-- doxytag: member="SerialPort::available" ref="af1024de6e41a21d1f362fedae73a2b39" args="(void)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::available </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void </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>The number of bytes (characters) available for reading from the serial port. </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00320">320</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a38b8cda8cb7c94a38de9f29ee48f4259"></a><!-- doxytag: member="SerialPort::begin" ref="a38b8cda8cb7c94a38de9f29ee48f4259" args="(uint32_t baud, uint8_t options=SP_8_BIT_CHAR)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::begin </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint32_t </td>
|
|
<td class="paramname"><em>baud</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>options</em> = <code><a class="el" href="a00005.html#aaacdef21e05f2054cef451d4f840317b">SP_8_BIT_CHAR</a></code> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Sets the data rate in bits per second (baud) for serial data transmission.</p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">baud</td><td>Rate in bits per second (baud). </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">options</td><td>constructed by a bitwise-inclusive OR of values from the following list. Choose one value for stop bit, parity, and character size.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<ul>
|
|
<li>SP_1_STOP_BIT - Use one stop bit (default if stop bit not specified).</li>
|
|
<li>SP_2_STOP_BIT - Use two stop bits.</li>
|
|
<li>SP_NO_PARITY - No parity bit (default if parity not specified).</li>
|
|
<li>SP_EVEN_PARITY - Add even parity bit.</li>
|
|
<li>SP_ODD_PARITY - Add odd parity bit.</li>
|
|
<li>SP_5_BIT_CHAR - Use 5-bit characters (default if size not specified).</li>
|
|
<li>SP_6_BIT_CHAR - Use 6-bit characters.</li>
|
|
<li>SP_7_BIT_CHAR - Use 7-bit characters.</li>
|
|
<li>SP_8_BIT_CHAR - Use 8-bit characters.</li>
|
|
</ul>
|
|
<p>The default is SP_8_BIT_CHAR which results in one stop bit, no parity, and 8-bit characters. </p>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00349">349</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a1de98218b494b92e683624aed3363386"></a><!-- doxytag: member="SerialPort::clearRxError" ref="a1de98218b494b92e683624aed3363386" args="()" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::clearRxError </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Clear RX error bits. </p>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00382">382</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a2f3d7c793365fcd861d3cce795d986f8"></a><!-- doxytag: member="SerialPort::end" ref="a2f3d7c793365fcd861d3cce795d986f8" args="()" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::end </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Disables serial communication, allowing the RX and TX pins to be used for general input and output. To re-enable serial communication, call <a class="el" href="a00001.html#a38b8cda8cb7c94a38de9f29ee48f4259">SerialPort::begin()</a>. </p>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00398">398</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a980a0188ad3ad64df2814462a5ebc707"></a><!-- doxytag: member="SerialPort::flush" ref="a980a0188ad3ad64df2814462a5ebc707" args="()" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::flush </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>For Arduino 1.0 and greater call <a class="el" href="a00001.html#abb49b6680762ee9b87fc9b0c578fb878">flushTx()</a>. </p>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00412">412</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ad2757ef24789a658405832447ae66bf5"></a><!-- doxytag: member="SerialPort::flushRx" ref="ad2757ef24789a658405832447ae66bf5" args="()" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::flushRx </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Discard any buffered incoming serial data. </p>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00417">417</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="abb49b6680762ee9b87fc9b0c578fb878"></a><!-- doxytag: member="SerialPort::flushTx" ref="abb49b6680762ee9b87fc9b0c578fb878" args="()" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::flushTx </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Waits for the transmission of outgoing serial data to complete. </p>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00429">429</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a1987a9d938995932929830be0adf4bf6"></a><!-- doxytag: member="SerialPort::getRxError" ref="a1987a9d938995932929830be0adf4bf6" args="()" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::getRxError </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>RX error bits. Possible error bits are:<ul>
|
|
<li><a class="el" href="a00005.html#a2ad06f836f28d76e35006eabe2a70f53">SP_RX_BUF_OVERRUN</a></li>
|
|
<li><a class="el" href="a00005.html#aba276deb6f876a8cf7e0f895cfbb37c8">SP_RX_DATA_OVERRUN</a></li>
|
|
<li><a class="el" href="a00005.html#a2a7a0989d2d7a5f27a0eef14b4052f5e">SP_FRAMING_ERROR</a></li>
|
|
<li><a class="el" href="a00005.html#a2ea2d7ccb17a58a56c0726bf21e12b61">SP_PARITY_ERROR</a></li>
|
|
</ul>
|
|
</dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00390">390</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="aa467bbb3efb104c8f52cba13ef3b30a0"></a><!-- doxytag: member="SerialPort::peek" ref="aa467bbb3efb104c8f52cba13ef3b30a0" args="(void)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::peek </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void </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>The first byte of incoming serial data available or -1 if no data is available. -1 is always returned for unbuffered RX. </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00439">439</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a6f20328c42db732c9243ce3a90d1e029"></a><!-- doxytag: member="SerialPort::read" ref="a6f20328c42db732c9243ce3a90d1e029" args="()" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::read </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Read incoming serial data.</p>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>The first byte of incoming serial data available or -1 if no data is available. </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00450">450</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="acb3106febfe5e47077bfa3439b4631c0"></a><!-- doxytag: member="SerialPort::read" ref="acb3106febfe5e47077bfa3439b4631c0" args="(uint8_t *b, size_t n)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::read </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>b</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>n</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Read incoming serial data. Stop when RX buffer is empty or n bytes have been read.</p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">b</td><td>The location to receive the data. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">n</td><td>Maximum number of bytes to read. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes read. </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00472">472</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a63bb0a672b9bbe05d798379e3cfb57b3"></a><!-- doxytag: member="SerialPort::write" ref="a63bb0a672b9bbe05d798379e3cfb57b3" args="(const __FlashStringHelper *s)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::write </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const __FlashStringHelper * </td>
|
|
<td class="paramname"><em>s</em></td><td>)</td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Write a flash string to the serial port.</p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">s</td><td>The string to be written. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes written to the serial port. </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00568">568</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="aae0a527e45a020a56fb3ec50bc7dee3b"></a><!-- doxytag: member="SerialPort::write" ref="aae0a527e45a020a56fb3ec50bc7dee3b" args="(const char *s)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::write </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>s</em></td><td>)</td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Write a string to the serial port.</p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">s</td><td>The string to be written. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes written to the serial port </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00620">620</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ae56f856288b08e2b7304a79f62081947"></a><!-- doxytag: member="SerialPort::write" ref="ae56f856288b08e2b7304a79f62081947" args="(const uint8_t *b, size_t n)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::write </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const uint8_t * </td>
|
|
<td class="paramname"><em>b</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>n</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Write binary data to the serial port.</p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">b</td><td>Location of the bytes to be written. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">n</td><td>The number of bytes to write. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes written to the serial port. </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00594">594</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a47aa3f8bdc6709e92275ac7d26e8cdb2"></a><!-- doxytag: member="SerialPort::write" ref="a47aa3f8bdc6709e92275ac7d26e8cdb2" args="(uint8_t b)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::write </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>b</em></td><td>)</td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Write binary data to the serial port.</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 to be written. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes written to the serial port. </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00498">498</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a3e1d910680b806a12b8505c8f20d0a76"></a><!-- doxytag: member="SerialPort::write_P" ref="a3e1d910680b806a12b8505c8f20d0a76" args="(PGM_P b, size_t n)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::write_P </td>
|
|
<td>(</td>
|
|
<td class="paramtype">PGM_P </td>
|
|
<td class="paramname"><em>b</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>n</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Write binary data from flash memory to the serial port.</p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">b</td><td>Location of the bytes to be written. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">n</td><td>The number of bytes to write. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes written to the serial port. </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00542">542</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ae783622f9524b84c547577dff64a3d73"></a><!-- doxytag: member="SerialPort::writeln" ref="ae783622f9524b84c547577dff64a3d73" args="(const __FlashStringHelper *s)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::writeln </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const __FlashStringHelper * </td>
|
|
<td class="paramname"><em>s</em></td><td>)</td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Write a flash string to the serial port followed by CR/LF.</p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">s</td><td>The string to be written. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes written to the serial port. </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00581">581</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a44c4ee83aa047ba1c458ca0969a9bf47"></a><!-- doxytag: member="SerialPort::writeln" ref="a44c4ee83aa047ba1c458ca0969a9bf47" args="(const char *s)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::writeln </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>s</em></td><td>)</td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Write a string to the serial port followed by CR/LF.</p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">s</td><td>The string to be written. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes written to the serial port. </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00529">529</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a903a10dc74404eda0ec8ae8b7eac93c2"></a><!-- doxytag: member="SerialPort::writeln" ref="a903a10dc74404eda0ec8ae8b7eac93c2" args="()" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<uint8_t PortNumber, size_t RxBufSize, size_t TxBufSize> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t <a class="el" href="a00001.html">SerialPort</a>< PortNumber, RxBufSize, TxBufSize >::writeln </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<p>Write CR/LF. </p>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>2 </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="a00005_source.html#l00516">516</a> of file <a class="el" href="a00005_source.html">SerialPort.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following file:<ul>
|
|
<li>Arduino/libraries/SerialPort/<a class="el" href="a00005_source.html">SerialPort.h</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"> </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>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 
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
|
|
</body>
|
|
</html>
|