/ RFout1MHzV1_03 / NMEAGPS_cfg.h
NMEAGPS_cfg.h
1 #ifndef NMEAGPS_CFG_H 2 #define NMEAGPS_CFG_H 3 4 //------------------------------------------------------ 5 // Enable/disable the parsing of specific sentences. 6 // 7 // Configuring out a sentence prevents it from being recognized; it 8 // will be completely ignored. (See also NMEAGPS_RECOGNIZE_ALL, below) 9 // 10 // FYI: Only RMC and ZDA contain date information. Other 11 // sentences contain time information. Both date and time are 12 // required if you will be doing time_t-to-clock_t operations. 13 14 //#define NMEAGPS_PARSE_GGA 15 //#define NMEAGPS_PARSE_GLL 16 //#define NMEAGPS_PARSE_GSA 17 #define NMEAGPS_PARSE_GSV 18 //#define NMEAGPS_PARSE_GST 19 #define NMEAGPS_PARSE_RMC 20 //#define NMEAGPS_PARSE_VTG 21 //#define NMEAGPS_PARSE_ZDA 22 23 //------------------------------------------------------ 24 // Select which sentence is sent *last* by your GPS device 25 // in each update interval. This can be used by your sketch 26 // to determine when the GPS quiet time begins, and thus 27 // when you can perform "some" time-consuming operations. 28 29 #define LAST_SENTENCE_IN_INTERVAL NMEAGPS::NMEA_RMC 30 31 // If the NMEA_LAST_SENTENCE_IN_INTERVAL is not chosen 32 // correctly, GPS data may be lost because the sketch 33 // takes too long elsewhere when this sentence is received. 34 // Also, fix members may contain information from different 35 // time intervals (i.e., they are not coherent). 36 // 37 // If you don't know which sentence is the last one, 38 // use NMEAorder.ino to list them. You do not have to select 39 // the last sentence the device sends if you have disabled 40 // it. Just select the last sentence that you have *enabled*. 41 42 //------------------------------------------------------ 43 // Enable/Disable coherency: 44 // 45 // If you need each fix to contain information that is only 46 // from the current update interval, you should uncomment 47 // this define. At the beginning of the next interval, 48 // the accumulating fix will start out empty. When 49 // the LAST_SENTENCE_IN_INTERVAL arrives, the valid 50 // fields will be coherent. 51 52 //#define NMEAGPS_COHERENT 53 54 // With IMPLICIT merging, fix() will be emptied when the 55 // next sentence begins. 56 // 57 // With EXPLICIT or NO merging, the fix() was already 58 // being initialized. 59 // 60 // If you use the fix-oriented methods available() and read(), 61 // they will empty the current fix for you automatically. 62 // 63 // If you use the character-oriented method decode(), you should 64 // empty the accumulating fix by testing and clearing the 65 // 'intervalComplete' flag in the same way that available() does. 66 67 //------------------------------------------------------ 68 // Choose how multiple sentences are merged: 69 // 1) No merging 70 // Each sentence fills out its own fix; there could be 71 // multiple sentences per interval. 72 // 2) EXPLICIT_MERGING 73 // All sentences in an interval are *safely* merged into one fix. 74 // NMEAGPS_FIX_MAX must be >= 1. 75 // An interval is defined by NMEA_LAST_SENTENCE_IN_INTERVAL. 76 // 3) IMPLICIT_MERGING 77 // All sentences in an interval are merged into one fix, with 78 // possible data loss. If a received sentence is rejected for 79 // any reason (e.g., a checksum error), all the values are suspect. 80 // The fix will be cleared; no members will be valid until new 81 // sentences are received and accepted. This uses less RAM. 82 // An interval is defined by NMEA_LAST_SENTENCE_IN_INTERVAL. 83 // Uncomment zero or one: 84 85 #define NMEAGPS_EXPLICIT_MERGING 86 //#define NMEAGPS_IMPLICIT_MERGING 87 88 #ifdef NMEAGPS_IMPLICIT_MERGING 89 #define NMEAGPS_MERGING NMEAGPS::IMPLICIT_MERGING 90 91 // When accumulating, nothing is done to the fix at the 92 // beginning of every sentence... 93 #ifdef NMEAGPS_COHERENT 94 // ...unless COHERENT is enabled and a new interval is starting 95 #define NMEAGPS_INIT_FIX(m) \ 96 if (intervalComplete()) { intervalComplete( false ); m.valid.init(); } 97 #else 98 #define NMEAGPS_INIT_FIX(m) 99 #endif 100 101 // ...but we invalidate one part when it starts to get parsed. It *may* get 102 // validated when the parsing is finished. 103 #define NMEAGPS_INVALIDATE(m) m_fix.valid.m = false 104 105 #else 106 107 #ifdef NMEAGPS_EXPLICIT_MERGING 108 #define NMEAGPS_MERGING NMEAGPS::EXPLICIT_MERGING 109 #else 110 #define NMEAGPS_MERGING NMEAGPS::NO_MERGING 111 #define NMEAGPS_NO_MERGING 112 #endif 113 114 // When NOT accumulating, invalidate the entire fix at the 115 // beginning of every sentence 116 #define NMEAGPS_INIT_FIX(m) m.valid.init() 117 118 // ...so the individual parts do not need to be invalidated as they are parsed 119 #define NMEAGPS_INVALIDATE(m) 120 121 #endif 122 123 #if ( defined(NMEAGPS_NO_MERGING) + \ 124 defined(NMEAGPS_IMPLICIT_MERGING) + \ 125 defined(NMEAGPS_EXPLICIT_MERGING) ) > 1 126 #error Only one MERGING technique should be enabled in NMEAGPS_cfg.h! 127 #endif 128 129 //------------------------------------------------------ 130 // Define the fix buffer size. The NMEAGPS object will hold on to 131 // this many fixes before an overrun occurs. This can be zero, 132 // but you have to be more careful about using gps.fix() structure, 133 // because it will be modified as characters are received. 134 135 #define NMEAGPS_FIX_MAX 1 136 137 #if defined(NMEAGPS_EXPLICIT_MERGING) && (NMEAGPS_FIX_MAX == 0) 138 #error You must define FIX_MAX >= 1 to allow EXPLICIT merging in NMEAGPS_cfg.h 139 #endif 140 141 //------------------------------------------------------ 142 // Enable/Disable interrupt-style processing of GPS characters 143 // If you are using one of the NeoXXSerial libraries, 144 // to attachInterrupt, this must be defined. 145 // Otherwise, it must be commented out. 146 147 //#define NMEAGPS_INTERRUPT_PROCESSING 148 149 #ifdef NMEAGPS_INTERRUPT_PROCESSING 150 #define NMEAGPS_PROCESSING_STYLE NMEAGPS::PS_INTERRUPT 151 #else 152 #define NMEAGPS_PROCESSING_STYLE NMEAGPS::PS_POLLING 153 #endif 154 155 //------------------------------------------------------ 156 // Enable/disable the talker ID, manufacturer ID and proprietary message processing. 157 // 158 // First, some background information. There are two kinds of NMEA sentences: 159 // 160 // 1. Standard NMEA sentences begin with "$ttccc", where 161 // "tt" is the talker ID, and 162 // "ccc" is the variable-length sentence type (i.e., command). 163 // 164 // For example, "$GPGLL,..." is a GLL sentence (Geographic Lat/Long) 165 // transmitted by talker "GP". This is the most common talker ID. Some 166 // devices may report "$GNGLL,..." when a mix of GPS and non-GPS 167 // satellites have been used to determine the GLL data. 168 // 169 // 2. Proprietary NMEA sentences (i.e., those unique to a particular 170 // manufacturer) begin with "$Pmmmccc", where 171 // "P" is the NMEA-defined prefix indicator for proprietary messages, 172 // "mmm" is the 3-character manufacturer ID, and 173 // "ccc" is the variable-length sentence type (it can be empty). 174 // 175 // No validation of manufacturer ID and talker ID is performed in this 176 // base class. For example, although "GP" is a common talker ID, it is not 177 // guaranteed to be transmitted by your particular device, and it IS NOT 178 // REQUIRED. If you need validation of these IDs, or you need to use the 179 // extra information provided by some devices, you have two independent 180 // options: 181 // 182 // 1. Enable SAVING the ID: When /decode/ returns DECODE_COMPLETED, the 183 // /talker_id/ and/or /mfr_id/ members will contain ID bytes. The entire 184 // sentence will be parsed, perhaps modifying members of /fix/. You should 185 // enable one or both IDs if you want the information in all sentences *and* 186 // you also want to know the ID bytes. This adds two bytes of RAM for the 187 // talker ID, and 3 bytes of RAM for the manufacturer ID. 188 // 189 // 2. Enable PARSING the ID: The virtual /parse_talker_id/ and 190 // /parse_mfr_id/ will receive each ID character as it is parsed. If it 191 // is not a valid ID, return /false/ to abort processing the rest of the 192 // sentence. No CPU time will be wasted on the invalid sentence, and no 193 // /fix/ members will be modified. You should enable this if you want to 194 // ignore some IDs. You must override /parse_talker_id/ and/or 195 // /parse_mfr_id/ in a derived class. 196 // 197 198 //#define NMEAGPS_SAVE_TALKER_ID 199 //#define NMEAGPS_PARSE_TALKER_ID 200 201 //#define NMEAGPS_PARSE_PROPRIETARY 202 #ifdef NMEAGPS_PARSE_PROPRIETARY 203 //#define NMEAGPS_SAVE_MFR_ID 204 #define NMEAGPS_PARSE_MFR_ID 205 #endif 206 207 //------------------------------------------------------ 208 // Enable/disable tracking the current satellite array and, 209 // optionally, all the info for each satellite. 210 // 211 212 #define NMEAGPS_PARSE_SATELLITES 213 #define NMEAGPS_PARSE_SATELLITE_INFO 214 215 #ifdef NMEAGPS_PARSE_SATELLITES 216 #define NMEAGPS_MAX_SATELLITES (20) 217 218 #ifndef GPS_FIX_SATELLITES 219 #error GPS_FIX_SATELLITES must be defined in GPSfix.h! 220 #endif 221 222 #endif 223 224 #if defined(NMEAGPS_PARSE_SATELLITE_INFO) & \ 225 !defined(NMEAGPS_PARSE_SATELLITES) 226 #error NMEAGPS_PARSE_SATELLITES must be defined! 227 #endif 228 229 //------------------------------------------------------ 230 // Enable/disable gathering interface statistics: 231 // CRC errors and number of sentences received 232 233 #define NMEAGPS_STATS 234 235 //------------------------------------------------------ 236 // Configuration item for allowing derived types of NMEAGPS. 237 // If you derive classes from NMEAGPS, you *must* define NMEAGPS_DERIVED_TYPES. 238 // If not defined, virtuals are not used, with a slight size (2 bytes) and 239 // execution time savings. 240 241 //#define NMEAGPS_DERIVED_TYPES 242 243 #ifdef NMEAGPS_DERIVED_TYPES 244 #define NMEAGPS_VIRTUAL virtual 245 #else 246 #define NMEAGPS_VIRTUAL 247 #endif 248 249 //----------------------------------- 250 // See if DERIVED_TYPES is required 251 #if (defined(NMEAGPS_PARSE_TALKER_ID) | defined(NMEAGPS_PARSE_MFR_ID)) & \ 252 !defined(NMEAGPS_DERIVED_TYPES) 253 #error You must define NMEAGPS_DERIVED_TYPES in NMEAGPS.h in order to parse Talker and/or Mfr IDs! 254 #endif 255 256 //------------------------------------------------------ 257 // Some devices may omit trailing commas at the end of some 258 // sentences. This may prevent the last field from being 259 // parsed correctly, because the parser for some types keep 260 // the value in an intermediate state until the complete 261 // field is received (e.g., parseDDDMM, parseFloat and 262 // parseZDA). 263 // 264 // Enabling this will inject a simulated comma when the end 265 // of a sentence is received and the last field parser 266 // indicated that it still needs one. 267 268 //#define NMEAGPS_COMMA_NEEDED 269 270 //------------------------------------------------------ 271 // Some applications may want to recognize a sentence type 272 // without actually parsing any of the fields. Uncommenting 273 // this define will allow the nmeaMessage member to be set 274 // when *any* standard message is seen, even though that 275 // message is not enabled by a NMEAGPS_PARSE_xxx define above. 276 // No valid flags will be true for those sentences. 277 278 #define NMEAGPS_RECOGNIZE_ALL 279 280 //------------------------------------------------------ 281 // Sometimes, a little extra space is needed to parse an intermediate form. 282 // This config items enables extra space. 283 284 //#define NMEAGPS_PARSING_SCRATCHPAD 285 286 #endif