| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 6 | kaklik | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> |
||
| 3 | <title>Procyon AVRlib: tsip.c Source File</title> |
||
| 4 | <link href="dox.css" rel="stylesheet" type="text/css"> |
||
| 5 | </head><body> |
||
| 6 | <!-- Generated by Doxygen 1.4.2 --> |
||
| 7 | <div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div> |
||
| 8 | <h1>tsip.c</h1><a href="tsip_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file tsip.c \brief TSIP (Trimble Standard Interface Protocol) function library. */</span> |
||
| 9 | 00002 <span class="comment">//*****************************************************************************</span> |
||
| 10 | 00003 <span class="comment">//</span> |
||
| 11 | 00004 <span class="comment">// File Name : 'tsip.c'</span> |
||
| 12 | 00005 <span class="comment">// Title : TSIP (Trimble Standard Interface Protocol) function library</span> |
||
| 13 | 00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2002-2003</span> |
||
| 14 | 00007 <span class="comment">// Created : 2002.08.27</span> |
||
| 15 | 00008 <span class="comment">// Revised : 2003.07.17</span> |
||
| 16 | 00009 <span class="comment">// Version : 0.1</span> |
||
| 17 | 00010 <span class="comment">// Target MCU : Atmel AVR Series</span> |
||
| 18 | 00011 <span class="comment">// Editor Tabs : 4</span> |
||
| 19 | 00012 <span class="comment">//</span> |
||
| 20 | 00013 <span class="comment">// NOTE: This code is currently below version 1.0, and therefore is considered</span> |
||
| 21 | 00014 <span class="comment">// to be lacking in some functionality or documentation, or may not be fully</span> |
||
| 22 | 00015 <span class="comment">// tested. Nonetheless, you can expect most functions to work.</span> |
||
| 23 | 00016 <span class="comment">//</span> |
||
| 24 | 00017 <span class="comment">// This code is distributed under the GNU Public License</span> |
||
| 25 | 00018 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span> |
||
| 26 | 00019 <span class="comment">//</span> |
||
| 27 | 00020 <span class="comment">//*****************************************************************************</span> |
||
| 28 | 00021 |
||
| 29 | 00022 <span class="preprocessor">#ifndef WIN32</span> |
||
| 30 | 00023 <span class="preprocessor"></span><span class="preprocessor"> #include <avr/io.h></span> |
||
| 31 | 00024 <span class="preprocessor"> #include <avr/pgmspace.h></span> |
||
| 32 | 00025 <span class="preprocessor"> #include <math.h></span> |
||
| 33 | 00026 <span class="preprocessor"> #include <stdlib.h></span> |
||
| 34 | 00027 <span class="preprocessor">#endif</span> |
||
| 35 | 00028 <span class="preprocessor"></span> |
||
| 36 | 00029 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span> |
||
| 37 | 00030 <span class="preprocessor">#include "<a class="code" href="buffer_8h.html">buffer.h</a>"</span> |
||
| 38 | 00031 <span class="preprocessor">#include "<a class="code" href="rprintf_8h.html">rprintf.h</a>"</span> |
||
| 39 | 00032 <span class="preprocessor">#include "<a class="code" href="uart2_8h.html">uart2.h</a>"</span> |
||
| 40 | 00033 <span class="preprocessor">#include "<a class="code" href="gps_8h.html">gps.h</a>"</span> |
||
| 41 | 00034 |
||
| 42 | 00035 <span class="preprocessor">#include "<a class="code" href="tsip_8h.html">tsip.h</a>"</span> |
||
| 43 | 00036 |
||
| 44 | 00037 <span class="comment">// Program ROM constants</span> |
||
| 45 | 00038 |
||
| 46 | 00039 <span class="comment">// Global variables</span> |
||
| 47 | 00040 <span class="keyword">extern</span> GpsInfoType GpsInfo; |
||
| 48 | 00041 <span class="preprocessor">#define BUFFERSIZE 0x40</span> |
||
| 49 | 00042 <span class="preprocessor"></span>u08 TsipPacket[BUFFERSIZE]; |
||
| 50 | 00043 u08 debug; |
||
| 51 | 00044 |
||
| 52 | 00045 <span class="comment">// function pointer to single byte output routine</span> |
||
| 53 | 00046 <span class="keyword">static</span> void (*TsipTxByteFunc)(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> c); |
||
| 54 | 00047 |
||
| 55 | 00048 <span class="keywordtype">void</span> tsipInit(<span class="keywordtype">void</span> (*txbytefunc)(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> c)) |
||
| 56 | 00049 { |
||
| 57 | 00050 <span class="comment">// set transmit function</span> |
||
| 58 | 00051 <span class="comment">// (this function will be used for all SendPacket commands)</span> |
||
| 59 | 00052 TsipTxByteFunc = txbytefunc; |
||
| 60 | 00053 |
||
| 61 | 00054 <span class="comment">// set debug status</span> |
||
| 62 | 00055 debug = 0; |
||
| 63 | 00056 |
||
| 64 | 00057 <span class="comment">// compose GPS receiver configuration packet</span> |
||
| 65 | 00058 u08 packet[4]; |
||
| 66 | 00059 packet[0] = BV(POS_LLA); |
||
| 67 | 00060 packet[1] = BV(VEL_ENU); |
||
| 68 | 00061 packet[2] = 0; |
||
| 69 | 00062 packet[3] = 0; |
||
| 70 | 00063 <span class="comment">// send configuration</span> |
||
| 71 | 00064 tsipSendPacket(TSIPTYPE_SET_IO_OPTIONS, 4, packet); |
||
| 72 | 00065 } |
||
| 73 | 00066 |
||
| 74 | 00067 <span class="keywordtype">void</span> tsipSendPacket(u08 tsipType, u08 dataLength, u08* data) |
||
| 75 | 00068 { |
||
| 76 | 00069 u08 i; |
||
| 77 | 00070 u08 dataIdx = 0; |
||
| 78 | 00071 |
||
| 79 | 00072 <span class="comment">// start of packet</span> |
||
| 80 | 00073 TsipPacket[dataIdx++] = DLE; |
||
| 81 | 00074 <span class="comment">// packet type</span> |
||
| 82 | 00075 TsipPacket[dataIdx++] = tsipType; |
||
| 83 | 00076 <span class="comment">// add packet data</span> |
||
| 84 | 00077 <span class="keywordflow">for</span>(i=0; i<dataLength; i++) |
||
| 85 | 00078 { |
||
| 86 | 00079 <span class="keywordflow">if</span>(*data == DLE) |
||
| 87 | 00080 { |
||
| 88 | 00081 <span class="comment">// do double-DLE escape sequence</span> |
||
| 89 | 00082 TsipPacket[dataIdx++] = *data; |
||
| 90 | 00083 TsipPacket[dataIdx++] = *data++; |
||
| 91 | 00084 } |
||
| 92 | 00085 <span class="keywordflow">else</span> |
||
| 93 | 00086 TsipPacket[dataIdx++] = *data++; |
||
| 94 | 00087 } |
||
| 95 | 00088 <span class="comment">// end of packet</span> |
||
| 96 | 00089 TsipPacket[dataIdx++] = DLE; |
||
| 97 | 00090 TsipPacket[dataIdx++] = ETX; |
||
| 98 | 00091 |
||
| 99 | 00092 <span class="keywordflow">for</span>(i=0; i<dataIdx; i++) |
||
| 100 | 00093 TsipTxByteFunc(TsipPacket[i]); |
||
| 101 | 00094 } |
||
| 102 | 00095 |
||
| 103 | 00096 u08 tsipProcess(<a class="code" href="structstruct__cBuffer.html">cBuffer</a>* rxBuffer) |
||
| 104 | 00097 { |
||
| 105 | 00098 u08 foundpacket = FALSE; |
||
| 106 | 00099 u08 startFlag = FALSE; |
||
| 107 | 00100 u08 data; |
||
| 108 | 00101 u08 i,j,k; |
||
| 109 | 00102 |
||
| 110 | 00103 u08 TsipPacketIdx; |
||
| 111 | 00104 |
||
| 112 | 00105 <span class="comment">// process the receive buffer</span> |
||
| 113 | 00106 <span class="comment">// go through buffer looking for packets</span> |
||
| 114 | 00107 <span class="keywordflow">while</span>(rxBuffer-><a class="code" href="structstruct__cBuffer.html#o2">datalength</a> > 1) |
||
| 115 | 00108 { |
||
| 116 | 00109 <span class="comment">// look for a potential start of TSIP packet</span> |
||
| 117 | 00110 <span class="keywordflow">if</span>(<a class="code" href="group__buffer.html#ga4">bufferGetAtIndex</a>(rxBuffer,0) == DLE) |
||
| 118 | 00111 { |
||
| 119 | 00112 <span class="comment">// make sure the next byte is not DLE or ETX</span> |
||
| 120 | 00113 data = <a class="code" href="group__buffer.html#ga4">bufferGetAtIndex</a>(rxBuffer,1); |
||
| 121 | 00114 <span class="keywordflow">if</span>((data != DLE) && (data != ETX)) |
||
| 122 | 00115 { |
||
| 123 | 00116 <span class="comment">// found potential start</span> |
||
| 124 | 00117 startFlag = TRUE; |
||
| 125 | 00118 <span class="comment">// done looking for start</span> |
||
| 126 | 00119 <span class="keywordflow">break</span>; |
||
| 127 | 00120 } |
||
| 128 | 00121 } |
||
| 129 | 00122 <span class="keywordflow">else</span> |
||
| 130 | 00123 <span class="comment">// not DLE, dump character from buffer</span> |
||
| 131 | 00124 <a class="code" href="group__buffer.html#ga2">bufferGetFromFront</a>(rxBuffer); |
||
| 132 | 00125 } |
||
| 133 | 00126 |
||
| 134 | 00127 <span class="comment">// if we detected a start, look for end of packet</span> |
||
| 135 | 00128 <span class="keywordflow">if</span>(startFlag) |
||
| 136 | 00129 { |
||
| 137 | 00130 <span class="keywordflow">for</span>(i=1; i<(rxBuffer-><a class="code" href="structstruct__cBuffer.html#o2">datalength</a>)-1; i++) |
||
| 138 | 00131 { |
||
| 139 | 00132 <span class="comment">// check for potential end of TSIP packet</span> |
||
| 140 | 00133 <span class="keywordflow">if</span>((<a class="code" href="group__buffer.html#ga4">bufferGetAtIndex</a>(rxBuffer,i) == DLE) && (<a class="code" href="group__buffer.html#ga4">bufferGetAtIndex</a>(rxBuffer,i+1) == ETX)) |
||
| 141 | 00134 { |
||
| 142 | 00135 <span class="comment">// have a packet end</span> |
||
| 143 | 00136 <span class="comment">// dump initial DLE</span> |
||
| 144 | 00137 <a class="code" href="group__buffer.html#ga2">bufferGetFromFront</a>(rxBuffer); |
||
| 145 | 00138 <span class="comment">// copy data to TsipPacket</span> |
||
| 146 | 00139 TsipPacketIdx = 0; |
||
| 147 | 00140 <span class="keywordflow">for</span>(j=0; j<(i-1); j++) |
||
| 148 | 00141 { |
||
| 149 | 00142 data = <a class="code" href="group__buffer.html#ga2">bufferGetFromFront</a>(rxBuffer); |
||
| 150 | 00143 <span class="keywordflow">if</span>(data == DLE) |
||
| 151 | 00144 { |
||
| 152 | 00145 <span class="keywordflow">if</span>(<a class="code" href="group__buffer.html#ga4">bufferGetAtIndex</a>(rxBuffer,0) == DLE) |
||
| 153 | 00146 { |
||
| 154 | 00147 <span class="comment">// found double-DLE escape sequence, skip one of them</span> |
||
| 155 | 00148 <a class="code" href="group__buffer.html#ga2">bufferGetFromFront</a>(rxBuffer); |
||
| 156 | 00149 j++; |
||
| 157 | 00150 } |
||
| 158 | 00151 } |
||
| 159 | 00152 TsipPacket[TsipPacketIdx++] = data; |
||
| 160 | 00153 } |
||
| 161 | 00154 <span class="comment">// dump ending DLE+ETX</span> |
||
| 162 | 00155 <a class="code" href="group__buffer.html#ga2">bufferGetFromFront</a>(rxBuffer); |
||
| 163 | 00156 <a class="code" href="group__buffer.html#ga2">bufferGetFromFront</a>(rxBuffer); |
||
| 164 | 00157 |
||
| 165 | 00158 <span class="comment">// found a packet</span> |
||
| 166 | 00159 <span class="keywordflow">if</span>(debug) |
||
| 167 | 00160 { |
||
| 168 | 00161 rprintf(<span class="stringliteral">"Rx TSIP packet type: 0x%x len: %d rawlen: %d\r\n"</span>, |
||
| 169 | 00162 TsipPacket[0], |
||
| 170 | 00163 TsipPacketIdx, |
||
| 171 | 00164 i); |
||
| 172 | 00165 <span class="keywordflow">for</span>(k=0; k<TsipPacketIdx; k++) |
||
| 173 | 00166 { |
||
| 174 | 00167 <a class="code" href="group__rprintf.html#ga7">rprintfu08</a>(TsipPacket[k]); |
||
| 175 | 00168 <a class="code" href="group__rprintf.html#ga1">rprintfChar</a>(<span class="charliteral">' '</span>); |
||
| 176 | 00169 } |
||
| 177 | 00170 <span class="comment">//rprintfu08(bufferGetFromFront(rxBuffer)); rprintfChar(' ');</span> |
||
| 178 | 00171 <span class="comment">//rprintfu08(bufferGetFromFront(rxBuffer)); rprintfChar(' ');</span> |
||
| 179 | 00172 |
||
| 180 | 00173 <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 181 | 00174 } |
||
| 182 | 00175 <span class="comment">// done with this processing session</span> |
||
| 183 | 00176 foundpacket = TRUE; |
||
| 184 | 00177 <span class="keywordflow">break</span>; |
||
| 185 | 00178 } |
||
| 186 | 00179 } |
||
| 187 | 00180 } |
||
| 188 | 00181 |
||
| 189 | 00182 <span class="keywordflow">if</span>(foundpacket) |
||
| 190 | 00183 { |
||
| 191 | 00184 <span class="comment">// switch on the packet type</span> |
||
| 192 | 00185 <span class="keywordflow">switch</span>(TsipPacket[0]) |
||
| 193 | 00186 { |
||
| 194 | 00187 <span class="keywordflow">case</span> TSIPTYPE_GPSTIME: tsipProcessGPSTIME(TsipPacket); <span class="keywordflow">break</span>; |
||
| 195 | 00188 <span class="keywordflow">case</span> TSIPTYPE_POSFIX_XYZ_SP: tsipProcessPOSFIX_XYZ_SP(TsipPacket); <span class="keywordflow">break</span>; |
||
| 196 | 00189 <span class="keywordflow">case</span> TSIPTYPE_VELFIX_XYZ: tsipProcessVELFIX_XYZ(TsipPacket); <span class="keywordflow">break</span>; |
||
| 197 | 00190 |
||
| 198 | 00191 <span class="keywordflow">case</span> TSIPTYPE_POSFIX_LLA_SP: tsipProcessPOSFIX_LLA_SP(TsipPacket); <span class="keywordflow">break</span>; |
||
| 199 | 00192 <span class="keywordflow">case</span> TSIPTYPE_VELFIX_ENU: tsipProcessVELFIX_ENU(TsipPacket); <span class="keywordflow">break</span>; |
||
| 200 | 00193 |
||
| 201 | 00194 <span class="keywordflow">case</span> TSIPTYPE_RAWDATA: <span class="keywordflow">break</span>; |
||
| 202 | 00195 <span class="keywordflow">default</span>: |
||
| 203 | 00196 <span class="comment">//if(debug) rprintf("Unhandled TSIP packet type: 0x%x\r\n",TsipPacket[0]);</span> |
||
| 204 | 00197 <span class="keywordflow">break</span>; |
||
| 205 | 00198 } |
||
| 206 | 00199 } |
||
| 207 | 00200 |
||
| 208 | 00201 <span class="keywordflow">return</span> foundpacket; |
||
| 209 | 00202 } |
||
| 210 | 00203 |
||
| 211 | 00204 <span class="keywordtype">void</span> tsipProcessGPSTIME(u08* packet) |
||
| 212 | 00205 { |
||
| 213 | 00206 <span class="comment">// NOTE: check endian-ness if porting to processors other than the AVR</span> |
||
| 214 | 00207 GpsInfo.TimeOfWeek.b[3] = packet[1]; |
||
| 215 | 00208 GpsInfo.TimeOfWeek.b[2] = packet[2]; |
||
| 216 | 00209 GpsInfo.TimeOfWeek.b[1] = packet[3]; |
||
| 217 | 00210 GpsInfo.TimeOfWeek.b[0] = packet[4]; |
||
| 218 | 00211 |
||
| 219 | 00212 GpsInfo.WeekNum = ((u16)packet[5]<<8)|((u16)packet[6]); |
||
| 220 | 00213 |
||
| 221 | 00214 GpsInfo.UtcOffset.b[3] = packet[7]; |
||
| 222 | 00215 GpsInfo.UtcOffset.b[2] = packet[8]; |
||
| 223 | 00216 GpsInfo.UtcOffset.b[1] = packet[9]; |
||
| 224 | 00217 GpsInfo.UtcOffset.b[0] = packet[10]; |
||
| 225 | 00218 } |
||
| 226 | 00219 |
||
| 227 | 00220 <span class="keywordtype">void</span> tsipProcessPOSFIX_XYZ_SP(u08* packet) |
||
| 228 | 00221 { |
||
| 229 | 00222 <span class="comment">// NOTE: check endian-ness if porting to processors other than the AVR</span> |
||
| 230 | 00223 GpsInfo.PosECEF.x.b[3] = packet[1]; |
||
| 231 | 00224 GpsInfo.PosECEF.x.b[2] = packet[2]; |
||
| 232 | 00225 GpsInfo.PosECEF.x.b[1] = packet[3]; |
||
| 233 | 00226 GpsInfo.PosECEF.x.b[0] = packet[4]; |
||
| 234 | 00227 |
||
| 235 | 00228 GpsInfo.PosECEF.y.b[3] = packet[5]; |
||
| 236 | 00229 GpsInfo.PosECEF.y.b[2] = packet[6]; |
||
| 237 | 00230 GpsInfo.PosECEF.y.b[1] = packet[7]; |
||
| 238 | 00231 GpsInfo.PosECEF.y.b[0] = packet[8]; |
||
| 239 | 00232 |
||
| 240 | 00233 GpsInfo.PosECEF.z.b[3] = packet[9]; |
||
| 241 | 00234 GpsInfo.PosECEF.z.b[2] = packet[10]; |
||
| 242 | 00235 GpsInfo.PosECEF.z.b[1] = packet[11]; |
||
| 243 | 00236 GpsInfo.PosECEF.z.b[0] = packet[12]; |
||
| 244 | 00237 |
||
| 245 | 00238 GpsInfo.PosECEF.TimeOfFix.b[3] = packet[13]; |
||
| 246 | 00239 GpsInfo.PosECEF.TimeOfFix.b[2] = packet[14]; |
||
| 247 | 00240 GpsInfo.PosECEF.TimeOfFix.b[1] = packet[15]; |
||
| 248 | 00241 GpsInfo.PosECEF.TimeOfFix.b[0] = packet[16]; |
||
| 249 | 00242 |
||
| 250 | 00243 GpsInfo.PosECEF.updates++; |
||
| 251 | 00244 |
||
| 252 | 00245 <span class="comment">// GpsInfo.TimeOfFix_ECEF.f = *((float*)&packet[13]);</span> |
||
| 253 | 00246 } |
||
| 254 | 00247 |
||
| 255 | 00248 <span class="keywordtype">void</span> tsipProcessVELFIX_XYZ(u08* packet) |
||
| 256 | 00249 { |
||
| 257 | 00250 } |
||
| 258 | 00251 |
||
| 259 | 00252 <span class="keywordtype">void</span> tsipProcessPOSFIX_LLA_SP(u08* packet) |
||
| 260 | 00253 { |
||
| 261 | 00254 <span class="comment">// NOTE: check endian-ness if porting to processors other than the AVR</span> |
||
| 262 | 00255 GpsInfo.PosLLA.lat.b[3] = packet[1]; |
||
| 263 | 00256 GpsInfo.PosLLA.lat.b[2] = packet[2]; |
||
| 264 | 00257 GpsInfo.PosLLA.lat.b[1] = packet[3]; |
||
| 265 | 00258 GpsInfo.PosLLA.lat.b[0] = packet[4]; |
||
| 266 | 00259 |
||
| 267 | 00260 GpsInfo.PosLLA.lon.b[3] = packet[5]; |
||
| 268 | 00261 GpsInfo.PosLLA.lon.b[2] = packet[6]; |
||
| 269 | 00262 GpsInfo.PosLLA.lon.b[1] = packet[7]; |
||
| 270 | 00263 GpsInfo.PosLLA.lon.b[0] = packet[8]; |
||
| 271 | 00264 |
||
| 272 | 00265 GpsInfo.PosLLA.alt.b[3] = packet[9]; |
||
| 273 | 00266 GpsInfo.PosLLA.alt.b[2] = packet[10]; |
||
| 274 | 00267 GpsInfo.PosLLA.alt.b[1] = packet[11]; |
||
| 275 | 00268 GpsInfo.PosLLA.alt.b[0] = packet[12]; |
||
| 276 | 00269 |
||
| 277 | 00270 GpsInfo.PosLLA.TimeOfFix.b[3] = packet[17]; |
||
| 278 | 00271 GpsInfo.PosLLA.TimeOfFix.b[2] = packet[18]; |
||
| 279 | 00272 GpsInfo.PosLLA.TimeOfFix.b[1] = packet[18]; |
||
| 280 | 00273 GpsInfo.PosLLA.TimeOfFix.b[0] = packet[20]; |
||
| 281 | 00274 |
||
| 282 | 00275 GpsInfo.PosLLA.updates++; |
||
| 283 | 00276 } |
||
| 284 | 00277 |
||
| 285 | 00278 <span class="keywordtype">void</span> tsipProcessVELFIX_ENU(u08* packet) |
||
| 286 | 00279 { |
||
| 287 | 00280 <span class="comment">// NOTE: check endian-ness if porting to processors other than the AVR</span> |
||
| 288 | 00281 GpsInfo.VelENU.east.b[3] = packet[1]; |
||
| 289 | 00282 GpsInfo.VelENU.east.b[2] = packet[2]; |
||
| 290 | 00283 GpsInfo.VelENU.east.b[1] = packet[3]; |
||
| 291 | 00284 GpsInfo.VelENU.east.b[0] = packet[4]; |
||
| 292 | 00285 |
||
| 293 | 00286 GpsInfo.VelENU.north.b[3] = packet[5]; |
||
| 294 | 00287 GpsInfo.VelENU.north.b[2] = packet[6]; |
||
| 295 | 00288 GpsInfo.VelENU.north.b[1] = packet[7]; |
||
| 296 | 00289 GpsInfo.VelENU.north.b[0] = packet[8]; |
||
| 297 | 00290 |
||
| 298 | 00291 GpsInfo.VelENU.up.b[3] = packet[9]; |
||
| 299 | 00292 GpsInfo.VelENU.up.b[2] = packet[10]; |
||
| 300 | 00293 GpsInfo.VelENU.up.b[1] = packet[11]; |
||
| 301 | 00294 GpsInfo.VelENU.up.b[0] = packet[12]; |
||
| 302 | 00295 |
||
| 303 | 00296 GpsInfo.VelENU.TimeOfFix.b[3] = packet[17]; |
||
| 304 | 00297 GpsInfo.VelENU.TimeOfFix.b[2] = packet[18]; |
||
| 305 | 00298 GpsInfo.VelENU.TimeOfFix.b[1] = packet[19]; |
||
| 306 | 00299 GpsInfo.VelENU.TimeOfFix.b[0] = packet[20]; |
||
| 307 | 00300 |
||
| 308 | 00301 GpsInfo.VelENU.updates++; |
||
| 309 | 00302 } |
||
| 310 | 00303 |
||
| 311 | 00304 <span class="keywordtype">void</span> tsipProcessRAWDATA(<a class="code" href="structstruct__cBuffer.html">cBuffer</a>* packet) |
||
| 312 | 00305 { |
||
| 313 | 00306 <span class="comment">/*</span> |
||
| 314 | 00307 <span class="comment"> char oft = 1;</span> |
||
| 315 | 00308 <span class="comment"> // process the data in TSIPdata</span> |
||
| 316 | 00309 <span class="comment"> unsigned char SVnum = TSIPdata[oft];</span> |
||
| 317 | 00310 <span class="comment"> unsigned __int32 SNR32 = (TSIPdata[oft+5] << 24) + (TSIPdata[oft+6] << 16) + (TSIPdata[oft+7] << 8) + (TSIPdata[oft+8]);</span> |
||
| 318 | 00311 <span class="comment"> unsigned __int32 codephase32 = (TSIPdata[oft+9] << 24) + (TSIPdata[oft+10] << 16) + (TSIPdata[oft+11] << 8) + (TSIPdata[oft+12]);</span> |
||
| 319 | 00312 <span class="comment"> unsigned __int32 doppler32 = (TSIPdata[oft+13] << 24) + (TSIPdata[oft+14] << 16) + (TSIPdata[oft+15] << 8) + (TSIPdata[oft+16]);</span> |
||
| 320 | 00313 <span class="comment"> </span> |
||
| 321 | 00314 <span class="comment"> unsigned __int64 meastimeH32 = (TSIPdata[oft+17] << 24) | (TSIPdata[oft+18] << 16) | (TSIPdata[oft+19] << 8) | (TSIPdata[oft+20]);</span> |
||
| 322 | 00315 <span class="comment"> unsigned __int64 meastimeL32 = (TSIPdata[oft+21] << 24) | (TSIPdata[oft+22] << 16) | (TSIPdata[oft+23] << 8) | (TSIPdata[oft+24]);</span> |
||
| 323 | 00316 <span class="comment"> unsigned __int64 meastime64 = (meastimeH32 << 32) | (meastimeL32);</span> |
||
| 324 | 00317 <span class="comment"> </span> |
||
| 325 | 00318 <span class="comment"> float SNR = *((float*) &SNR32);</span> |
||
| 326 | 00319 <span class="comment"> float codephase = *((float*) &codephase32);</span> |
||
| 327 | 00320 <span class="comment"> float doppler = *((float*) &doppler32);</span> |
||
| 328 | 00321 <span class="comment"> double meastime = *((double*) &meastime64);</span> |
||
| 329 | 00322 <span class="comment"> </span> |
||
| 330 | 00323 <span class="comment"> // output to screen</span> |
||
| 331 | 00324 <span class="comment"> printf("SV%2d SNR: %5.2f PH: %11.4f DOP: %11.4f TIME: %5.0I64f EPOCH: %7.2I64f\n",SVnum,SNR,codephase,doppler,meastime,meastime/1.5);</span> |
||
| 332 | 00325 <span class="comment"> //printf("SV%2d SNR: %5.2f PH: %10.4f DOP: %10.4f TIME: %I64x\n",SVnum,SNR,codephase,doppler,meastime64);</span> |
||
| 333 | 00326 <span class="comment"></span> |
||
| 334 | 00327 <span class="comment"> // output to file</span> |
||
| 335 | 00328 <span class="comment"> fprintf( logfile, "%2d %5.2f %11.4f %11.4f %5.0I64f %7.2I64f\n",SVnum,SNR,codephase,doppler,meastime,meastime/1.5);</span> |
||
| 336 | 00329 <span class="comment">*/</span> |
||
| 337 | 00330 } |
||
| 338 | 00331 |
||
| 339 | </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:07 2006 for Procyon AVRlib by |
||
| 340 | <a href="http://www.doxygen.org/index.html"> |
||
| 341 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address> |
||
| 342 | </body> |
||
| 343 | </html> |
Powered by WebSVN v2.8.3