ardupilot/libraries/doc/html/_better_stream_8cpp_source....

92 lines
5.8 KiB
HTML
Raw 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>ArduPilot Libraries: /home/jgoppert/Projects/ap/libraries/FastSerial/BetterStream.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.1 -->
<div class="navigation" id="top">
<div class="tabs">
<ul class="tablist">
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</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>
</ul>
</div>
<div class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul>
</div>
<div class="header">
<div class="headertitle">
<h1>/home/jgoppert/Projects/ap/libraries/FastSerial/BetterStream.cpp</h1> </div>
</div>
<div class="contents">
<a href="_better_stream_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- Mode: C++; c-basic-offset: 8; indent-tabs-mode: nil -*-</span>
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">// Copyright (c) 2010 Michael Smith. All rights reserved.</span>
<a name="l00004"></a>00004 <span class="comment">//</span>
<a name="l00005"></a>00005 <span class="comment">// This is free software; you can redistribute it and/or modify it under</span>
<a name="l00006"></a>00006 <span class="comment">// the terms of the GNU Lesser General Public License as published by the</span>
<a name="l00007"></a>00007 <span class="comment">// Free Software Foundation; either version 2.1 of the License, or (at</span>
<a name="l00008"></a>00008 <span class="comment">// your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment">//</span>
<a name="l00010"></a>00010
<a name="l00011"></a>00011 <span class="comment">//</span>
<a name="l00012"></a>00012 <span class="comment">// Enhancements to the Arduino Stream class.</span>
<a name="l00013"></a>00013 <span class="comment">//</span>
<a name="l00014"></a>00014
<a name="l00015"></a>00015 <span class="preprocessor">#include &quot;<a class="code" href="_better_stream_8h.html">BetterStream.h</a>&quot;</span>
<a name="l00016"></a>00016
<a name="l00017"></a>00017 <span class="comment">// Stream extensions////////////////////////////////////////////////////////////</span>
<a name="l00018"></a>00018
<a name="l00019"></a>00019 <span class="keywordtype">void</span>
<a name="l00020"></a>00020 <a class="code" href="class_better_stream.html#a0016dc539b93bf6856120604958114a0">BetterStream::print_P</a>(<span class="keyword">const</span> prog_char *s)
<a name="l00021"></a>00021 {
<a name="l00022"></a>00022 <span class="keywordtype">char</span> c;
<a name="l00023"></a>00023
<a name="l00024"></a>00024 <span class="keywordflow">while</span> (<span class="charliteral">&#39;\0&#39;</span> != (c = pgm_read_byte(s++)))
<a name="l00025"></a>00025 <a class="code" href="class_stream.html#a46cd2d80c276134f30300d619416d5c8">write</a>(c);
<a name="l00026"></a>00026 }
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="keywordtype">void</span>
<a name="l00029"></a><a class="code" href="class_better_stream.html#a6aac449cc793106cd8f78ea6934ae002">00029</a> <a class="code" href="class_better_stream.html#a6aac449cc793106cd8f78ea6934ae002">BetterStream::println_P</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *s)
<a name="l00030"></a>00030 {
<a name="l00031"></a>00031 <a class="code" href="class_better_stream.html#a0016dc539b93bf6856120604958114a0">print_P</a>(s);
<a name="l00032"></a>00032 println();
<a name="l00033"></a>00033 }
<a name="l00034"></a>00034
<a name="l00035"></a>00035 <span class="keywordtype">void</span>
<a name="l00036"></a><a class="code" href="class_better_stream.html#aa735777635173dca53f4d9a4f6a1e0b8">00036</a> <a class="code" href="class_better_stream.html#aa735777635173dca53f4d9a4f6a1e0b8">BetterStream::printf</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...)
<a name="l00037"></a>00037 {
<a name="l00038"></a>00038 va_list ap;
<a name="l00039"></a>00039
<a name="l00040"></a>00040 va_start(ap, fmt);
<a name="l00041"></a>00041 _vprintf(0, fmt, ap);
<a name="l00042"></a>00042 va_end(ap);
<a name="l00043"></a>00043 }
<a name="l00044"></a>00044
<a name="l00045"></a>00045 <span class="keywordtype">void</span>
<a name="l00046"></a><a class="code" href="class_better_stream.html#a53ea8468145fd16a3a137002b87040ad">00046</a> <a class="code" href="class_better_stream.html#a53ea8468145fd16a3a137002b87040ad">BetterStream::printf_P</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...)
<a name="l00047"></a>00047 {
<a name="l00048"></a>00048 va_list ap;
<a name="l00049"></a>00049
<a name="l00050"></a>00050 va_start(ap, fmt);
<a name="l00051"></a>00051 _vprintf(1, fmt, ap);
<a name="l00052"></a>00052 va_end(ap);
<a name="l00053"></a>00053 }
<a name="l00054"></a>00054
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 26 2010 21:58:34 for ArduPilot Libraries by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>