00001 // This file is part of MOS, the MANTIS Operating System 00002 // See http://mantis.cs.colorado.edu/ 00003 // 00004 // Copyright (c) 2002 - 2007 University of Colorado, Boulder 00005 // 00006 // All rights reserved. 00007 // 00008 // Redistribution and use in source and binary forms, with or without 00009 // modification, are permitted provided that the following conditions are 00010 // met: 00011 // 00012 // * Redistributions of source code must retain the above copyright 00013 // notice, this list of conditions and the following disclaimer. 00014 // * Redistributions in binary form must reproduce the above 00015 // copyright notice, this list of conditions and the following 00016 // disclaimer in the documentation and/or other materials provided 00017 // with the distribution. 00018 // * Neither the name of the MANTIS Project nor the names of its 00019 // contributors may be used to endorse or promote products derived 00020 // from this software without specific prior written permission. 00021 // 00022 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00025 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00026 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00027 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00028 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00029 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00030 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00031 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00032 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00033 // POSSIBILITY OF SUCH DAMAGE. 00034 00035 #ifndef __MICA2_GPS_H__ 00036 #define __MICA2_GPS_H__ 00037 00038 // pin 7 on switch 1 00039 #define GPS_POWER_ADDR (1 << 6) 00040 // pin 8 on switch 1 00041 #define GPS_ENABLE_ADDR (1 << 7) 00042 00043 // pin 2 on switch 2 00044 #define GPS_TX_ADDR (1 << 1) 00045 // pin 1 on switch 2 00046 #define GPS_RX_ADDR (1 << 0) 00047 00048 00049 #define GPS_TX_RX ( GPS_TX_ADDR | GPS_RX_ADDR ) 00050 00051 00052 // these two ADG715BRU switches on the i2c line 00053 // are used to connect peripherals on the weatherboard to 00054 // power, the uart, etc. 00055 00056 // switch 1 contains the enable switch for the GPS 00057 #define SWITCH_1 (uint16_t)0x48 /*72*/ 00058 // switch 2 contains the uart tx/rx switches for the GPS 00059 #define SWITCH_2 (uint16_t)0x49 /*73*/ 00060 00069 enum GPS_FIX_QUALITY 00070 { 00072 FIX_INVALID = 0, 00074 FIX_GPS, 00076 FIX_DGPS, 00078 FIX_PPS, 00080 FIX_RTK, 00082 FIX_FRTK, 00084 FIX_ESTIMATED, 00086 FIX_MANUAL, 00088 FIX_SIMULATION 00089 }; 00090 00093 enum MICA2_GPS_READ_TYPE 00094 { 00096 MICA2_GPS_READ_STRING, 00098 MICA2_GPS_READ_GGA 00099 }; 00100 00101 00102 00107 typedef struct timestamp_struct 00108 { 00110 uint8_t hours; 00112 uint8_t minutes; 00114 uint8_t seconds; 00115 00116 } timestamp_t; 00117 00122 typedef struct meter_struct 00123 { 00125 uint16_t whole; 00127 uint16_t decimal; 00128 00130 char units; 00131 } measurement_t; 00132 00137 typedef struct latitude_struct 00138 { 00140 uint16_t degrees; 00142 measurement_t minutes; 00144 char direction; 00145 } latlong_t; 00146 00147 00152 typedef struct gga_struct 00153 { 00155 timestamp_t utc; 00157 latlong_t latitude; 00159 latlong_t longitude; 00161 uint8_t fix_quality; 00163 uint8_t satellite_count; 00165 measurement_t horiz_dilution; 00167 measurement_t altitude; 00169 measurement_t geoid_height; 00171 uint16_t since_last_update; 00173 uint16_t dgps_id; 00174 } gps_gga_t; 00175 00179 void mica2_gps_print_gga(const gps_gga_t* gga); 00180 00181 00185 void mica2_gps_init(void); 00186 00187 #endif // __MICA2_GPS_H__
1.4.6