Ardupilot2/libraries/doc/html/_g_p_s_8cpp_source.html
james.goppert b852085f44 Updated documentation.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1287 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-27 02:59:34 +00:00

75 lines
5.4 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>ArduPilot Libraries: /home/jgoppert/Projects/ap/libraries/AP_GPS/GPS.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/AP_GPS/GPS.cpp</h1> </div>
</div>
<div class="contents">
<a href="_g_p_s_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-</span>
<a name="l00002"></a>00002
<a name="l00003"></a>00003 <span class="preprocessor">#include &quot;<a class="code" href="_g_p_s_8h.html" title="Interface definition for the various GPS drivers.">GPS.h</a>&quot;</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &quot;<a class="code" href="_w_program_8h.html">WProgram.h</a>&quot;</span>
<a name="l00005"></a>00005
<a name="l00006"></a>00006 <span class="keywordtype">void</span>
<a name="l00007"></a><a class="code" href="class_g_p_s.html#a05a534e0c72a450d6c9ae6207513e59a">00007</a> <a class="code" href="class_g_p_s.html#a05a534e0c72a450d6c9ae6207513e59a">GPS::update</a>(<span class="keywordtype">void</span>)
<a name="l00008"></a>00008 {
<a name="l00009"></a>00009 <span class="keywordtype">bool</span> result;
<a name="l00010"></a>00010
<a name="l00011"></a>00011 <span class="comment">// call the GPS driver to process incoming data</span>
<a name="l00012"></a>00012 result = <a class="code" href="class_g_p_s.html#a4b99d4f414678d48ecb19a655354cbe5">read</a>();
<a name="l00013"></a>00013
<a name="l00014"></a>00014 <span class="comment">// if we did not get a message, and the idle timer has expired, re-init</span>
<a name="l00015"></a>00015 <span class="keywordflow">if</span> (!result) {
<a name="l00016"></a>00016 <span class="keywordflow">if</span> ((<a class="code" href="test_8cpp.html#a941a22cb7e0f6429fe40f91e83ead3d9">millis</a>() - _idleTimer) &gt; _idleTimeout) {
<a name="l00017"></a>00017 _status = NO_GPS;
<a name="l00018"></a>00018 <a class="code" href="class_g_p_s.html#a2aecc2de1271d131b132ad2e259101ad">init</a>();
<a name="l00019"></a>00019 }
<a name="l00020"></a>00020 } <span class="keywordflow">else</span> {
<a name="l00021"></a>00021 <span class="comment">// we got a message, update our status correspondingly</span>
<a name="l00022"></a>00022 _status = <a class="code" href="class_g_p_s.html#a0b2a93a9f1d0e234d791177ea5f42078" title="true if we have a position fix (use status instead)">fix</a> ? <a class="code" href="class_g_p_s.html#aa3c9862ff33053e317f423a398bd92c0abd7c07383a51c659af88b8b7bd0df240" title="Receiving valid messages and locked.">GPS_OK</a> : NO_FIX;
<a name="l00023"></a>00023
<a name="l00024"></a>00024 <a class="code" href="class_g_p_s.html#a0f035818b7805f69f62cb1b734d7bf21" title="true if we have seen data from the GPS (use status instead)">valid_read</a> = <span class="keyword">true</span>;
<a name="l00025"></a>00025 <a class="code" href="class_g_p_s.html#a31aed57ed5fbfbfb0bb1e4105e337b9a">new_data</a> = <span class="keyword">true</span>;
<a name="l00026"></a>00026 }
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="comment">// reset the idle timer</span>
<a name="l00029"></a>00029 _idleTimer = <a class="code" href="test_8cpp.html#a941a22cb7e0f6429fe40f91e83ead3d9">millis</a>();
<a name="l00030"></a>00030 }
<a name="l00031"></a>00031
<a name="l00032"></a>00032 <span class="comment">// XXX this is probably the wrong way to do it, too</span>
<a name="l00033"></a>00033 <span class="keywordtype">void</span>
<a name="l00034"></a><a class="code" href="class_g_p_s.html#acfd79aa1f9bcad32c0b89c2b16d150cf">00034</a> <a class="code" href="class_g_p_s.html#acfd79aa1f9bcad32c0b89c2b16d150cf">GPS::_error</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *msg)
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036 <a class="code" href="_fast_serial_8h.html#a8e6f49b84135f0158fe250cb7338ddad">Serial</a>.println(msg);
<a name="l00037"></a>00037 }
</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>