Allows for a GPS module to be connected to a serial port and exposes an easy to use API to get the GPS data. New feature, added Mbed/LPC17xx RTC synchronisation
Fork of MODGPS by
GPS.h@1:6aec92e77ad2, 2010-11-20 (annotated)
- Committer:
- AjK
- Date:
- Sat Nov 20 21:02:06 2010 +0000
- Revision:
- 1:6aec92e77ad2
- Parent:
- 0:db98027c0bbb
- Child:
- 2:8aa059e7d8b1
1.11
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AjK | 0:db98027c0bbb | 1 | /* |
AjK | 0:db98027c0bbb | 2 | Copyright (c) 2010 Andy Kirkham |
AjK | 0:db98027c0bbb | 3 | |
AjK | 0:db98027c0bbb | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy |
AjK | 0:db98027c0bbb | 5 | of this software and associated documentation files (the "Software"), to deal |
AjK | 0:db98027c0bbb | 6 | in the Software without restriction, including without limitation the rights |
AjK | 0:db98027c0bbb | 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
AjK | 0:db98027c0bbb | 8 | copies of the Software, and to permit persons to whom the Software is |
AjK | 0:db98027c0bbb | 9 | furnished to do so, subject to the following conditions: |
AjK | 0:db98027c0bbb | 10 | |
AjK | 0:db98027c0bbb | 11 | The above copyright notice and this permission notice shall be included in |
AjK | 0:db98027c0bbb | 12 | all copies or substantial portions of the Software. |
AjK | 0:db98027c0bbb | 13 | |
AjK | 0:db98027c0bbb | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
AjK | 0:db98027c0bbb | 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
AjK | 0:db98027c0bbb | 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
AjK | 0:db98027c0bbb | 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
AjK | 0:db98027c0bbb | 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
AjK | 0:db98027c0bbb | 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
AjK | 0:db98027c0bbb | 20 | THE SOFTWARE. |
AjK | 0:db98027c0bbb | 21 | */ |
AjK | 0:db98027c0bbb | 22 | |
AjK | 0:db98027c0bbb | 23 | #ifndef GPS_H |
AjK | 0:db98027c0bbb | 24 | #define GPS_H |
AjK | 0:db98027c0bbb | 25 | |
AjK | 0:db98027c0bbb | 26 | #include "mbed.h" |
AjK | 0:db98027c0bbb | 27 | #include "GPS_Time.h" |
AjK | 0:db98027c0bbb | 28 | #include "GPS_Geodetic.h" |
AjK | 0:db98027c0bbb | 29 | |
AjK | 0:db98027c0bbb | 30 | #define GPS_RBR 0x00 |
AjK | 0:db98027c0bbb | 31 | #define GPS_THR 0x00 |
AjK | 0:db98027c0bbb | 32 | #define GPS_DLL 0x00 |
AjK | 0:db98027c0bbb | 33 | #define GPS_IER 0x04 |
AjK | 0:db98027c0bbb | 34 | #define GPS_DML 0x04 |
AjK | 0:db98027c0bbb | 35 | #define GPS_IIR 0x08 |
AjK | 0:db98027c0bbb | 36 | #define GPS_FCR 0x08 |
AjK | 0:db98027c0bbb | 37 | #define GPS_LCR 0x0C |
AjK | 0:db98027c0bbb | 38 | #define GPS_LSR 0x14 |
AjK | 0:db98027c0bbb | 39 | #define GPS_SCR 0x1C |
AjK | 0:db98027c0bbb | 40 | #define GPS_ACR 0x20 |
AjK | 0:db98027c0bbb | 41 | #define GPS_ICR 0x24 |
AjK | 0:db98027c0bbb | 42 | #define GPS_FDR 0x28 |
AjK | 0:db98027c0bbb | 43 | #define GPS_TER 0x30 |
AjK | 0:db98027c0bbb | 44 | |
AjK | 0:db98027c0bbb | 45 | #define GPS_BUFFER_LEN 128 |
AjK | 0:db98027c0bbb | 46 | #define GPS_TICKTOCK 10000 |
AjK | 0:db98027c0bbb | 47 | |
AjK | 1:6aec92e77ad2 | 48 | /** @defgroup API The MODGPS API */ |
AjK | 0:db98027c0bbb | 49 | |
AjK | 0:db98027c0bbb | 50 | /** GPS module |
AjK | 1:6aec92e77ad2 | 51 | * @author Andy Kirkham |
AjK | 0:db98027c0bbb | 52 | * @see http://mbed.org/cookbook/MODGPS |
AjK | 0:db98027c0bbb | 53 | * @see example1.cpp |
AjK | 0:db98027c0bbb | 54 | * @see example2.cpp |
AjK | 1:6aec92e77ad2 | 55 | * @see API |
AjK | 1:6aec92e77ad2 | 56 | * |
AjK | 1:6aec92e77ad2 | 57 | * @image html /media/uploads/AjK/gps_interfaces.png "Wiring up the GPS module" |
AjK | 0:db98027c0bbb | 58 | * |
AjK | 0:db98027c0bbb | 59 | * Example: |
AjK | 0:db98027c0bbb | 60 | * @code |
AjK | 0:db98027c0bbb | 61 | * #include "mbed.h" |
AjK | 0:db98027c0bbb | 62 | * #include "GPS.h" |
AjK | 0:db98027c0bbb | 63 | * |
AjK | 0:db98027c0bbb | 64 | * DigitalOut led1(LED1); |
AjK | 0:db98027c0bbb | 65 | * Serial pc(USBTX, USBRX); |
AjK | 0:db98027c0bbb | 66 | * GPS gps(NC, p10); |
AjK | 0:db98027c0bbb | 67 | * |
AjK | 0:db98027c0bbb | 68 | * int main() { |
AjK | 0:db98027c0bbb | 69 | * GPS_Time t; |
AjK | 0:db98027c0bbb | 70 | * |
AjK | 0:db98027c0bbb | 71 | * // Wait for the GPS NMEA data to become valid. |
AjK | 0:db98027c0bbb | 72 | * while (!gps.isTimeValid()) { |
AjK | 0:db98027c0bbb | 73 | * led1 = !led1; |
AjK | 0:db98027c0bbb | 74 | * wait(1); |
AjK | 0:db98027c0bbb | 75 | * } |
AjK | 0:db98027c0bbb | 76 | * |
AjK | 0:db98027c0bbb | 77 | * gps.timeNow(&t); |
AjK | 0:db98027c0bbb | 78 | * |
AjK | 0:db98027c0bbb | 79 | * pc.printf("The time/date is %02d:%02d:%02d %02d/%02d/%04d\r\n", |
AjK | 0:db98027c0bbb | 80 | * t.hour, t.minute, t.second, t.day, t.month, t.year); |
AjK | 0:db98027c0bbb | 81 | * |
AjK | 0:db98027c0bbb | 82 | * // Wait until at least four satellites produce a position fix and a valid quality. |
AjK | 0:db98027c0bbb | 83 | * while (gps.numOfSats() < 4 && gps.getGPSquality != 0) { |
AjK | 0:db98027c0bbb | 84 | * led1 = !led1; |
AjK | 0:db98027c0bbb | 85 | * wait(1); |
AjK | 0:db98027c0bbb | 86 | * } |
AjK | 0:db98027c0bbb | 87 | * |
AjK | 0:db98027c0bbb | 88 | * pc.printf("Lat = %.4f Lon = %.4f Alt = %.1fkm\r\n", |
AjK | 0:db98027c0bbb | 89 | * gps.latitude(), gps.longitude, gps.altitude()); |
AjK | 0:db98027c0bbb | 90 | * |
AjK | 0:db98027c0bbb | 91 | * // Make the LED go steady to indicate we have finished. |
AjK | 0:db98027c0bbb | 92 | * led1 = 1; |
AjK | 0:db98027c0bbb | 93 | * |
AjK | 0:db98027c0bbb | 94 | * while(1) {} |
AjK | 0:db98027c0bbb | 95 | * } |
AjK | 0:db98027c0bbb | 96 | * @endcode |
AjK | 0:db98027c0bbb | 97 | */ |
AjK | 0:db98027c0bbb | 98 | |
AjK | 0:db98027c0bbb | 99 | class GPS : Serial { |
AjK | 0:db98027c0bbb | 100 | public: |
AjK | 0:db98027c0bbb | 101 | |
AjK | 0:db98027c0bbb | 102 | //! The PPS edge type to interrupt on. |
AjK | 0:db98027c0bbb | 103 | enum ppsEdgeType { |
AjK | 0:db98027c0bbb | 104 | ppsRise = 0, /*!< Use the rising edge (default). */ |
AjK | 0:db98027c0bbb | 105 | ppsFall /*!< Use the falling edge. */ |
AjK | 0:db98027c0bbb | 106 | }; |
AjK | 0:db98027c0bbb | 107 | |
AjK | 0:db98027c0bbb | 108 | //! A copy of the Serial parity enum |
AjK | 0:db98027c0bbb | 109 | enum Parity { |
AjK | 0:db98027c0bbb | 110 | None = 0 |
AjK | 0:db98027c0bbb | 111 | , Odd |
AjK | 0:db98027c0bbb | 112 | , Even |
AjK | 0:db98027c0bbb | 113 | , Forced1 |
AjK | 0:db98027c0bbb | 114 | , Forced0 |
AjK | 0:db98027c0bbb | 115 | }; |
AjK | 0:db98027c0bbb | 116 | |
AjK | 0:db98027c0bbb | 117 | //! GPS constructor. |
AjK | 0:db98027c0bbb | 118 | /** |
AjK | 0:db98027c0bbb | 119 | * The GPS constructor is used to initialise the GPS object. |
AjK | 0:db98027c0bbb | 120 | * |
AjK | 0:db98027c0bbb | 121 | * @param tx Usually unused and set to NC |
AjK | 0:db98027c0bbb | 122 | * @param rx The RX pin the GPS is connected to, p10, p14( OR p25), p27. |
AjK | 0:db98027c0bbb | 123 | * @param name An option name for RPC usage. |
AjK | 0:db98027c0bbb | 124 | */ |
AjK | 0:db98027c0bbb | 125 | GPS(PinName tx, PinName rx, const char *name = NULL); |
AjK | 0:db98027c0bbb | 126 | |
AjK | 0:db98027c0bbb | 127 | //! Is the time reported by the GPS valid. |
AjK | 0:db98027c0bbb | 128 | /** |
AjK | 0:db98027c0bbb | 129 | * Method used to check the validity of the time the GPS module is reporting. |
AjK | 0:db98027c0bbb | 130 | * |
AjK | 0:db98027c0bbb | 131 | * @code |
AjK | 0:db98027c0bbb | 132 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 133 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 134 | * |
AjK | 0:db98027c0bbb | 135 | * if (gps.isTimeValid()) { |
AjK | 0:db98027c0bbb | 136 | * // Time is valid :) |
AjK | 0:db98027c0bbb | 137 | * } |
AjK | 0:db98027c0bbb | 138 | * else { |
AjK | 0:db98027c0bbb | 139 | * // Doh, time is not valid :( |
AjK | 0:db98027c0bbb | 140 | * ) |
AjK | 0:db98027c0bbb | 141 | * |
AjK | 0:db98027c0bbb | 142 | * @endcode |
AjK | 0:db98027c0bbb | 143 | * |
AjK | 0:db98027c0bbb | 144 | * @ingroup API |
AjK | 0:db98027c0bbb | 145 | * @return bool true if valid, false otherwise |
AjK | 0:db98027c0bbb | 146 | */ |
AjK | 0:db98027c0bbb | 147 | bool isTimeValid(void) { return theTime.status == 'V' ? false : true; } |
AjK | 0:db98027c0bbb | 148 | |
AjK | 0:db98027c0bbb | 149 | //! Is the positional fix reported by the GPS valid. |
AjK | 0:db98027c0bbb | 150 | /** |
AjK | 0:db98027c0bbb | 151 | * Method used to check the validity of the positional data. This method |
AjK | 0:db98027c0bbb | 152 | * returns the GGA field, 0 is "bad, 1 is "ok", etc. See the NMEA GGA |
AjK | 1:6aec92e77ad2 | 153 | * description for more details. |
AjK | 1:6aec92e77ad2 | 154 | * |
AjK | 1:6aec92e77ad2 | 155 | * @code |
AjK | 1:6aec92e77ad2 | 156 | * // Assuming we have a GPS object previously created... |
AjK | 1:6aec92e77ad2 | 157 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 158 | * |
AjK | 1:6aec92e77ad2 | 159 | * if (gps.getGPSquality() == 0) { |
AjK | 1:6aec92e77ad2 | 160 | * // The location fix is no good/not accurate :( |
AjK | 1:6aec92e77ad2 | 161 | * } |
AjK | 1:6aec92e77ad2 | 162 | * else { |
AjK | 1:6aec92e77ad2 | 163 | * // All good, can use last fix data. |
AjK | 1:6aec92e77ad2 | 164 | * ) |
AjK | 1:6aec92e77ad2 | 165 | * |
AjK | 1:6aec92e77ad2 | 166 | * @endcode |
AjK | 1:6aec92e77ad2 | 167 | * |
AjK | 1:6aec92e77ad2 | 168 | * @ingroup API |
AjK | 0:db98027c0bbb | 169 | * @return int 0 on no fix, 1... (see NMEA GGA for more details). |
AjK | 0:db98027c0bbb | 170 | */ |
AjK | 0:db98027c0bbb | 171 | int getGPSquality(void) { return thePlace.getGPSquality(); } |
AjK | 0:db98027c0bbb | 172 | |
AjK | 0:db98027c0bbb | 173 | //! How many satellites were used in the last fix. |
AjK | 0:db98027c0bbb | 174 | /** |
AjK | 0:db98027c0bbb | 175 | * Method returns the number of GPS satellites used on the last fix. |
AjK | 0:db98027c0bbb | 176 | * |
AjK | 0:db98027c0bbb | 177 | * @code |
AjK | 0:db98027c0bbb | 178 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 179 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 180 | * |
AjK | 0:db98027c0bbb | 181 | * int sats = gps.numOfSats(); |
AjK | 0:db98027c0bbb | 182 | * |
AjK | 0:db98027c0bbb | 183 | * @endcode |
AjK | 0:db98027c0bbb | 184 | * |
AjK | 0:db98027c0bbb | 185 | * @ingroup API |
AjK | 0:db98027c0bbb | 186 | * @return int The number of satellites. |
AjK | 0:db98027c0bbb | 187 | */ |
AjK | 0:db98027c0bbb | 188 | int numOfSats(void) { return thePlace.numOfSats(); } |
AjK | 0:db98027c0bbb | 189 | |
AjK | 0:db98027c0bbb | 190 | //! What was the last reported latitude (in degrees) |
AjK | 0:db98027c0bbb | 191 | /** |
AjK | 0:db98027c0bbb | 192 | * Method returns a double in degrees, positive being North, negative being South. |
AjK | 0:db98027c0bbb | 193 | * |
AjK | 0:db98027c0bbb | 194 | * @code |
AjK | 0:db98027c0bbb | 195 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 196 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 197 | * |
AjK | 0:db98027c0bbb | 198 | * double latitude = gps.latitude(); |
AjK | 0:db98027c0bbb | 199 | * |
AjK | 0:db98027c0bbb | 200 | * @endcode |
AjK | 0:db98027c0bbb | 201 | * |
AjK | 0:db98027c0bbb | 202 | * @ingroup API |
AjK | 0:db98027c0bbb | 203 | * @return double Degrees |
AjK | 0:db98027c0bbb | 204 | */ |
AjK | 0:db98027c0bbb | 205 | double latitude(void); |
AjK | 0:db98027c0bbb | 206 | |
AjK | 0:db98027c0bbb | 207 | //! What was the last reported longitude (in degrees) |
AjK | 0:db98027c0bbb | 208 | /** |
AjK | 0:db98027c0bbb | 209 | * Method returns a double in degrees, positive being East, negative being West. |
AjK | 0:db98027c0bbb | 210 | * |
AjK | 0:db98027c0bbb | 211 | * @code |
AjK | 0:db98027c0bbb | 212 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 213 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 214 | * |
AjK | 0:db98027c0bbb | 215 | * double logitude = gps.logitude(); |
AjK | 0:db98027c0bbb | 216 | * |
AjK | 0:db98027c0bbb | 217 | * @endcode |
AjK | 0:db98027c0bbb | 218 | * |
AjK | 0:db98027c0bbb | 219 | * @ingroup API |
AjK | 0:db98027c0bbb | 220 | * @return double Degrees |
AjK | 0:db98027c0bbb | 221 | */ |
AjK | 0:db98027c0bbb | 222 | double longitude(void); |
AjK | 0:db98027c0bbb | 223 | |
AjK | 0:db98027c0bbb | 224 | //! What was the last reported altitude (in kilometers) |
AjK | 0:db98027c0bbb | 225 | /** |
AjK | 0:db98027c0bbb | 226 | * Method returns a double in kilometers. |
AjK | 0:db98027c0bbb | 227 | * |
AjK | 0:db98027c0bbb | 228 | * @code |
AjK | 0:db98027c0bbb | 229 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 230 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 231 | * |
AjK | 0:db98027c0bbb | 232 | * double altitude = gps.altitude(); |
AjK | 0:db98027c0bbb | 233 | * |
AjK | 0:db98027c0bbb | 234 | * @endcode |
AjK | 0:db98027c0bbb | 235 | * |
AjK | 0:db98027c0bbb | 236 | * @ingroup API |
AjK | 0:db98027c0bbb | 237 | * @return double Kilometers |
AjK | 0:db98027c0bbb | 238 | */ |
AjK | 0:db98027c0bbb | 239 | double altitude(void); |
AjK | 0:db98027c0bbb | 240 | |
AjK | 0:db98027c0bbb | 241 | //! What was the last reported altitude/height (in kilometers) |
AjK | 0:db98027c0bbb | 242 | /** |
AjK | 0:db98027c0bbb | 243 | * @see altitude() |
AjK | 0:db98027c0bbb | 244 | * |
AjK | 0:db98027c0bbb | 245 | * @code |
AjK | 0:db98027c0bbb | 246 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 247 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 248 | * |
AjK | 0:db98027c0bbb | 249 | * double height = gps.height(); |
AjK | 0:db98027c0bbb | 250 | * |
AjK | 0:db98027c0bbb | 251 | * @endcode |
AjK | 0:db98027c0bbb | 252 | * |
AjK | 0:db98027c0bbb | 253 | * Note, this is identical to altitude() |
AjK | 0:db98027c0bbb | 254 | * @see altitude() |
AjK | 0:db98027c0bbb | 255 | * |
AjK | 0:db98027c0bbb | 256 | * @ingroup API |
AjK | 0:db98027c0bbb | 257 | * @return double Kilometers |
AjK | 0:db98027c0bbb | 258 | */ |
AjK | 0:db98027c0bbb | 259 | double height(void) { return altitude(); } |
AjK | 0:db98027c0bbb | 260 | |
AjK | 0:db98027c0bbb | 261 | //! Get all three geodetic parameters together. |
AjK | 0:db98027c0bbb | 262 | /** |
AjK | 0:db98027c0bbb | 263 | * Pass a pointer to a GPS_Geodetic object and the current |
AjK | 0:db98027c0bbb | 264 | * GPS data will be copied into it. |
AjK | 0:db98027c0bbb | 265 | * |
AjK | 0:db98027c0bbb | 266 | * @code |
AjK | 0:db98027c0bbb | 267 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 268 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 269 | * |
AjK | 0:db98027c0bbb | 270 | * // Then get the data... |
AjK | 0:db98027c0bbb | 271 | * GPS_Geodetic p; |
AjK | 0:db98027c0bbb | 272 | * gps.geodetic(&p); |
AjK | 0:db98027c0bbb | 273 | * printf("Latitude = %.4f", p.lat); |
AjK | 0:db98027c0bbb | 274 | * printf("Longitude = %.4f", p.lon); |
AjK | 0:db98027c0bbb | 275 | * printf("Altitude = %.4f", p.alt); |
AjK | 0:db98027c0bbb | 276 | * |
AjK | 0:db98027c0bbb | 277 | * @endcode |
AjK | 0:db98027c0bbb | 278 | * |
AjK | 0:db98027c0bbb | 279 | * @ingroup API |
AjK | 0:db98027c0bbb | 280 | * @param g A GSP_Geodetic pointer to an existing GPS_Geodetic object. |
AjK | 0:db98027c0bbb | 281 | * @return GPS_Geodetic * The pointer passed in. |
AjK | 0:db98027c0bbb | 282 | */ |
AjK | 0:db98027c0bbb | 283 | GPS_Geodetic *geodetic(GPS_Geodetic *g); |
AjK | 0:db98027c0bbb | 284 | |
AjK | 0:db98027c0bbb | 285 | //! Get all three geodetic parameters together. |
AjK | 0:db98027c0bbb | 286 | /** |
AjK | 0:db98027c0bbb | 287 | * Get all the geodetic data at once. For example:- |
AjK | 0:db98027c0bbb | 288 | * |
AjK | 0:db98027c0bbb | 289 | * @code |
AjK | 0:db98027c0bbb | 290 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 291 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 292 | * |
AjK | 0:db98027c0bbb | 293 | * // Then get the data... |
AjK | 0:db98027c0bbb | 294 | * GPS_Geodetic *p = gps.geodetic(); |
AjK | 0:db98027c0bbb | 295 | * printf("Latitude = %.4f", p->lat); |
AjK | 0:db98027c0bbb | 296 | * delete(p); // then remember to delete the object to prevent memory leaks. |
AjK | 0:db98027c0bbb | 297 | * |
AjK | 0:db98027c0bbb | 298 | * @endcode |
AjK | 0:db98027c0bbb | 299 | * |
AjK | 0:db98027c0bbb | 300 | * @ingroup API |
AjK | 0:db98027c0bbb | 301 | * @return GPS_Geodetic * A pointer to the data. |
AjK | 0:db98027c0bbb | 302 | */ |
AjK | 0:db98027c0bbb | 303 | GPS_Geodetic *geodetic(void) { return geodetic(NULL); } |
AjK | 0:db98027c0bbb | 304 | |
AjK | 0:db98027c0bbb | 305 | //! Take a snap shot of the current time. |
AjK | 0:db98027c0bbb | 306 | /** |
AjK | 0:db98027c0bbb | 307 | * Pass a pointer to a GPS_Time object to get a copy of the current |
AjK | 0:db98027c0bbb | 308 | * time and date as reported by the GPS. |
AjK | 0:db98027c0bbb | 309 | * |
AjK | 0:db98027c0bbb | 310 | * @code |
AjK | 0:db98027c0bbb | 311 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 312 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 313 | * |
AjK | 0:db98027c0bbb | 314 | * // Then get the data... |
AjK | 0:db98027c0bbb | 315 | * GPS_Time t; |
AjK | 0:db98027c0bbb | 316 | * gps.timeNow(&t); |
AjK | 0:db98027c0bbb | 317 | * printf("Year = %d", t.year); |
AjK | 0:db98027c0bbb | 318 | * |
AjK | 0:db98027c0bbb | 319 | * @endcode |
AjK | 0:db98027c0bbb | 320 | * |
AjK | 0:db98027c0bbb | 321 | * @ingroup API |
AjK | 0:db98027c0bbb | 322 | * @param n A GPS_Time * pointer to an existing GPS_Time object. |
AjK | 0:db98027c0bbb | 323 | * @return GPS_Time * The pointer passed in. |
AjK | 0:db98027c0bbb | 324 | */ |
AjK | 0:db98027c0bbb | 325 | GPS_Time * timeNow(GPS_Time *n) { return theTime.timeNow(n); } |
AjK | 0:db98027c0bbb | 326 | |
AjK | 0:db98027c0bbb | 327 | //! Take a snap shot of the current time. |
AjK | 0:db98027c0bbb | 328 | /** |
AjK | 0:db98027c0bbb | 329 | * Pass a pointer to a GPS_Time object to get a copy of the current |
AjK | 0:db98027c0bbb | 330 | * time and date as reported by the GPS. |
AjK | 0:db98027c0bbb | 331 | * |
AjK | 0:db98027c0bbb | 332 | * @code |
AjK | 0:db98027c0bbb | 333 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 334 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 335 | * |
AjK | 0:db98027c0bbb | 336 | * // Then get the data... |
AjK | 0:db98027c0bbb | 337 | * GPS_Time *t = gps.timeNow(); |
AjK | 0:db98027c0bbb | 338 | * printf("Year = %d", t->year); |
AjK | 0:db98027c0bbb | 339 | * delete(t); // Avoid memory leaks. |
AjK | 0:db98027c0bbb | 340 | * |
AjK | 0:db98027c0bbb | 341 | * @endcode |
AjK | 0:db98027c0bbb | 342 | * |
AjK | 0:db98027c0bbb | 343 | * @ingroup API |
AjK | 0:db98027c0bbb | 344 | * @return GPS_Time * The pointer passed in. |
AjK | 0:db98027c0bbb | 345 | */ |
AjK | 0:db98027c0bbb | 346 | GPS_Time * timeNow(void) { GPS_Time *n = new GPS_Time; return theTime.timeNow(n); } |
AjK | 0:db98027c0bbb | 347 | |
AjK | 0:db98027c0bbb | 348 | //! Return the curent day. |
AjK | 0:db98027c0bbb | 349 | /** |
AjK | 0:db98027c0bbb | 350 | * @code |
AjK | 0:db98027c0bbb | 351 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 352 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 353 | * |
AjK | 0:db98027c0bbb | 354 | * // Then get the Julain Day Number. |
AjK | 0:db98027c0bbb | 355 | * double julianDayNumber = gps.julianDayNumber(); |
AjK | 0:db98027c0bbb | 356 | * |
AjK | 0:db98027c0bbb | 357 | * @endcode |
AjK | 0:db98027c0bbb | 358 | * |
AjK | 0:db98027c0bbb | 359 | * @ingroup API |
AjK | 0:db98027c0bbb | 360 | * @return double The Julian Date as a double. |
AjK | 0:db98027c0bbb | 361 | */ |
AjK | 0:db98027c0bbb | 362 | double julianDayNumber(void) { return theTime.julian_day_number(); } |
AjK | 0:db98027c0bbb | 363 | |
AjK | 0:db98027c0bbb | 364 | //! Return the curent date/time as a Julian date |
AjK | 0:db98027c0bbb | 365 | /** |
AjK | 0:db98027c0bbb | 366 | * @code |
AjK | 0:db98027c0bbb | 367 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 368 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 369 | * |
AjK | 0:db98027c0bbb | 370 | * // Then get the Julian Date. |
AjK | 0:db98027c0bbb | 371 | * double julianDate = gps.julianDate(); |
AjK | 0:db98027c0bbb | 372 | * |
AjK | 0:db98027c0bbb | 373 | * @endcode |
AjK | 0:db98027c0bbb | 374 | * |
AjK | 0:db98027c0bbb | 375 | * @ingroup API |
AjK | 0:db98027c0bbb | 376 | * @return double The Julian Date as a double. |
AjK | 0:db98027c0bbb | 377 | */ |
AjK | 0:db98027c0bbb | 378 | double julianDate(void) { return theTime.julian_date(); } |
AjK | 0:db98027c0bbb | 379 | |
AjK | 0:db98027c0bbb | 380 | //! Get the current sidereal degree angle. |
AjK | 0:db98027c0bbb | 381 | /** |
AjK | 0:db98027c0bbb | 382 | * @code |
AjK | 0:db98027c0bbb | 383 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 384 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 385 | * double sidereal = gps.siderealDegrees(); |
AjK | 0:db98027c0bbb | 386 | * |
AjK | 0:db98027c0bbb | 387 | * @endcode |
AjK | 0:db98027c0bbb | 388 | * |
AjK | 0:db98027c0bbb | 389 | * @ingroup API |
AjK | 0:db98027c0bbb | 390 | * @return double Sidereal degree angle.. |
AjK | 0:db98027c0bbb | 391 | */ |
AjK | 0:db98027c0bbb | 392 | double siderealDegrees(void) { return theTime.siderealDegrees(&theTime, longitude()); } |
AjK | 0:db98027c0bbb | 393 | |
AjK | 0:db98027c0bbb | 394 | //! Get the current sidereal hour angle. |
AjK | 0:db98027c0bbb | 395 | /** |
AjK | 0:db98027c0bbb | 396 | * @code |
AjK | 0:db98027c0bbb | 397 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 398 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 399 | * double sidereal = gps.siderealHA(); |
AjK | 0:db98027c0bbb | 400 | * |
AjK | 0:db98027c0bbb | 401 | * @endcode |
AjK | 0:db98027c0bbb | 402 | * |
AjK | 0:db98027c0bbb | 403 | * @ingroup API |
AjK | 0:db98027c0bbb | 404 | * @return double Sidereal degree angle.. |
AjK | 0:db98027c0bbb | 405 | */ |
AjK | 0:db98027c0bbb | 406 | double siderealHA(void) { return theTime.siderealHA(&theTime, longitude()); } |
AjK | 0:db98027c0bbb | 407 | |
AjK | 0:db98027c0bbb | 408 | //! Optionally, connect a 1PPS single to an Mbed pin. |
AjK | 0:db98027c0bbb | 409 | /** |
AjK | 0:db98027c0bbb | 410 | * Optional: If the GPS unit has a 1PPS output, use this to |
AjK | 0:db98027c0bbb | 411 | * connect that to our internal ISR. Using the 1PPS increases |
AjK | 0:db98027c0bbb | 412 | * the GPS_Time time accuracy from +/-0.25s to +/-0.001s |
AjK | 0:db98027c0bbb | 413 | * |
AjK | 0:db98027c0bbb | 414 | * @code |
AjK | 0:db98027c0bbb | 415 | * // Assuming we have a GPS object previously created... |
AjK | 0:db98027c0bbb | 416 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 417 | * |
AjK | 0:db98027c0bbb | 418 | * gps.ppsAttach(p29); // default to GPS::ppsRise, rising edge. |
AjK | 0:db98027c0bbb | 419 | * |
AjK | 0:db98027c0bbb | 420 | * // Or... |
AjK | 0:db98027c0bbb | 421 | * gps.ppsAttach(p29, GPS::ppsRise); // The default. |
AjK | 0:db98027c0bbb | 422 | * |
AjK | 0:db98027c0bbb | 423 | * // Or... |
AjK | 0:db98027c0bbb | 424 | * gps.ppsAttach(p29, GPS::ppsFall); // If a falling edge. |
AjK | 0:db98027c0bbb | 425 | * |
AjK | 0:db98027c0bbb | 426 | * @endcode |
AjK | 0:db98027c0bbb | 427 | * |
AjK | 0:db98027c0bbb | 428 | * <b>Note</b>, before using this function you should attach an actual |
AjK | 0:db98027c0bbb | 429 | * callback function using attach_pps() |
AjK | 0:db98027c0bbb | 430 | * |
AjK | 0:db98027c0bbb | 431 | * @see attach_pps() |
AjK | 0:db98027c0bbb | 432 | * |
AjK | 0:db98027c0bbb | 433 | * @ingroup API |
AjK | 0:db98027c0bbb | 434 | * @param irq A PinName to attach |
AjK | 0:db98027c0bbb | 435 | * @param type The type of edge, MAX7456::ppsRise OR MAX7456::ppsFall |
AjK | 0:db98027c0bbb | 436 | */ |
AjK | 0:db98027c0bbb | 437 | void ppsAttach(PinName irq, ppsEdgeType type = ppsRise); |
AjK | 0:db98027c0bbb | 438 | |
AjK | 0:db98027c0bbb | 439 | //! Remove any 1PPS signal previously attached. |
AjK | 0:db98027c0bbb | 440 | void ppsUnattach(void); |
AjK | 0:db98027c0bbb | 441 | |
AjK | 0:db98027c0bbb | 442 | //! GPS serial receive interrupt handler. |
AjK | 0:db98027c0bbb | 443 | void rx_irq(void); |
AjK | 0:db98027c0bbb | 444 | |
AjK | 0:db98027c0bbb | 445 | //! GPS pps interrupt handler. |
AjK | 0:db98027c0bbb | 446 | void pps_irq(void); |
AjK | 0:db98027c0bbb | 447 | |
AjK | 0:db98027c0bbb | 448 | //! A pointer to the UART peripheral base address being used. |
AjK | 0:db98027c0bbb | 449 | void *_base; |
AjK | 0:db98027c0bbb | 450 | |
AjK | 0:db98027c0bbb | 451 | //! The RX serial buffer. |
AjK | 0:db98027c0bbb | 452 | char buffer[2][GPS_BUFFER_LEN]; |
AjK | 0:db98027c0bbb | 453 | |
AjK | 0:db98027c0bbb | 454 | //! The current "active" buffer, i.e. the buffer the ISR is writing to. |
AjK | 0:db98027c0bbb | 455 | int active_buffer; |
AjK | 0:db98027c0bbb | 456 | |
AjK | 0:db98027c0bbb | 457 | //! The active buffer "in" pointer. |
AjK | 0:db98027c0bbb | 458 | int rx_buffer_in; |
AjK | 0:db98027c0bbb | 459 | |
AjK | 0:db98027c0bbb | 460 | //! Boolean flag set when the "passive" buffer is full and needs processing. |
AjK | 0:db98027c0bbb | 461 | bool process_required; |
AjK | 0:db98027c0bbb | 462 | |
AjK | 0:db98027c0bbb | 463 | //! 10ms Ticker callback. |
AjK | 0:db98027c0bbb | 464 | void ticktock(void); |
AjK | 0:db98027c0bbb | 465 | |
AjK | 0:db98027c0bbb | 466 | //! Attach a user object/method callback function to the PPS signal |
AjK | 0:db98027c0bbb | 467 | /** |
AjK | 0:db98027c0bbb | 468 | * Attach a user callback object/method to call when the 1PPS signal activates. |
AjK | 0:db98027c0bbb | 469 | * |
AjK | 0:db98027c0bbb | 470 | * @code |
AjK | 0:db98027c0bbb | 471 | * class FOO { |
AjK | 0:db98027c0bbb | 472 | * public: |
AjK | 0:db98027c0bbb | 473 | * void myCallback(void); |
AjK | 0:db98027c0bbb | 474 | * }; |
AjK | 0:db98027c0bbb | 475 | * |
AjK | 0:db98027c0bbb | 476 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 477 | * Foo foo; |
AjK | 0:db98027c0bbb | 478 | * |
AjK | 0:db98027c0bbb | 479 | * gps.attach_pps(foo, &FOO::myCallback); |
AjK | 0:db98027c0bbb | 480 | * |
AjK | 0:db98027c0bbb | 481 | * @endcode |
AjK | 0:db98027c0bbb | 482 | * |
AjK | 0:db98027c0bbb | 483 | * @ingroup API |
AjK | 0:db98027c0bbb | 484 | * @param tptr pointer to the object to call the member function on |
AjK | 0:db98027c0bbb | 485 | * @param mptr pointer to the member function to be called |
AjK | 0:db98027c0bbb | 486 | */ |
AjK | 0:db98027c0bbb | 487 | template<typename T> |
AjK | 0:db98027c0bbb | 488 | void attach_pps(T* tptr, void (T::*mptr)(void)) { cb_pps.attach(tptr, mptr); } |
AjK | 0:db98027c0bbb | 489 | |
AjK | 0:db98027c0bbb | 490 | //! Attach a user callback function to the PPS signal |
AjK | 0:db98027c0bbb | 491 | /** |
AjK | 0:db98027c0bbb | 492 | * Attach a user callback function pointer to call when the 1PPS signal activates. |
AjK | 0:db98027c0bbb | 493 | * |
AjK | 0:db98027c0bbb | 494 | * @code |
AjK | 0:db98027c0bbb | 495 | * void myCallback(void) { ... } |
AjK | 0:db98027c0bbb | 496 | * |
AjK | 0:db98027c0bbb | 497 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 498 | * Foo foo; |
AjK | 0:db98027c0bbb | 499 | * |
AjK | 0:db98027c0bbb | 500 | * gps.attach_pps(&myCallback); |
AjK | 0:db98027c0bbb | 501 | * |
AjK | 0:db98027c0bbb | 502 | * @endcode |
AjK | 0:db98027c0bbb | 503 | * |
AjK | 0:db98027c0bbb | 504 | * @ingroup API |
AjK | 0:db98027c0bbb | 505 | * @param fptr Callback function pointer |
AjK | 0:db98027c0bbb | 506 | */ |
AjK | 0:db98027c0bbb | 507 | void attach_pps(void (*fptr)(void)) { cb_pps.attach(fptr); } |
AjK | 0:db98027c0bbb | 508 | |
AjK | 0:db98027c0bbb | 509 | //! A callback object for the 1PPS user API. |
AjK | 0:db98027c0bbb | 510 | FunctionPointer cb_pps; |
AjK | 0:db98027c0bbb | 511 | |
AjK | 0:db98027c0bbb | 512 | //! Attach a user callback function to the NMEA RMC message processed signal. |
AjK | 0:db98027c0bbb | 513 | /** |
AjK | 0:db98027c0bbb | 514 | * Attach a user callback object/method to call when an NMEA RMC packet has been processed. |
AjK | 0:db98027c0bbb | 515 | * |
AjK | 0:db98027c0bbb | 516 | * @code |
AjK | 0:db98027c0bbb | 517 | * class FOO { |
AjK | 0:db98027c0bbb | 518 | * public: |
AjK | 0:db98027c0bbb | 519 | * void myCallback(void); |
AjK | 0:db98027c0bbb | 520 | * }; |
AjK | 0:db98027c0bbb | 521 | * |
AjK | 0:db98027c0bbb | 522 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 523 | * Foo foo; |
AjK | 0:db98027c0bbb | 524 | * |
AjK | 0:db98027c0bbb | 525 | * gps.attach_rmc(foo, &FOO::myCallback); |
AjK | 0:db98027c0bbb | 526 | * |
AjK | 0:db98027c0bbb | 527 | * @endcode |
AjK | 0:db98027c0bbb | 528 | * |
AjK | 0:db98027c0bbb | 529 | * @ingroup API |
AjK | 0:db98027c0bbb | 530 | * @param tptr pointer to the object to call the member function on |
AjK | 0:db98027c0bbb | 531 | * @param mptr pointer to the member function to be called |
AjK | 0:db98027c0bbb | 532 | */ |
AjK | 0:db98027c0bbb | 533 | template<typename T> |
AjK | 0:db98027c0bbb | 534 | void attach_rmc(T* tptr, void (T::*mptr)(void)) { cb_rmc.attach(tptr, mptr); } |
AjK | 0:db98027c0bbb | 535 | |
AjK | 0:db98027c0bbb | 536 | //! Attach a user callback function to the NMEA RMC message processed signal. |
AjK | 0:db98027c0bbb | 537 | /** |
AjK | 0:db98027c0bbb | 538 | * Attach a user callback function pointer to call when an NMEA RMC packet has been processed. |
AjK | 0:db98027c0bbb | 539 | * |
AjK | 0:db98027c0bbb | 540 | * @code |
AjK | 0:db98027c0bbb | 541 | * void myCallback(void) { ... } |
AjK | 0:db98027c0bbb | 542 | * |
AjK | 0:db98027c0bbb | 543 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 544 | * Foo foo; |
AjK | 0:db98027c0bbb | 545 | * |
AjK | 0:db98027c0bbb | 546 | * gps.attach_rmc(&myCallback); |
AjK | 0:db98027c0bbb | 547 | * |
AjK | 0:db98027c0bbb | 548 | * @endcode |
AjK | 0:db98027c0bbb | 549 | * |
AjK | 0:db98027c0bbb | 550 | * @ingroup API |
AjK | 0:db98027c0bbb | 551 | * @param fptr Callback function pointer. |
AjK | 0:db98027c0bbb | 552 | */ |
AjK | 0:db98027c0bbb | 553 | void attach_rmc(void (*fptr)(void)) { cb_rmc.attach(fptr); } |
AjK | 0:db98027c0bbb | 554 | |
AjK | 0:db98027c0bbb | 555 | //! A callback object for the NMEA RMS message processed signal user API. |
AjK | 0:db98027c0bbb | 556 | FunctionPointer cb_rmc; |
AjK | 0:db98027c0bbb | 557 | |
AjK | 0:db98027c0bbb | 558 | //! Attach a user callback function to the NMEA GGA message processed signal. |
AjK | 0:db98027c0bbb | 559 | /** |
AjK | 0:db98027c0bbb | 560 | * Attach a user callback object/method to call when an NMEA GGA packet has been processed. |
AjK | 0:db98027c0bbb | 561 | * |
AjK | 0:db98027c0bbb | 562 | * @code |
AjK | 0:db98027c0bbb | 563 | * class FOO { |
AjK | 0:db98027c0bbb | 564 | * public: |
AjK | 0:db98027c0bbb | 565 | * void myCallback(void); |
AjK | 0:db98027c0bbb | 566 | * }; |
AjK | 0:db98027c0bbb | 567 | * |
AjK | 0:db98027c0bbb | 568 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 569 | * Foo foo; |
AjK | 0:db98027c0bbb | 570 | * |
AjK | 0:db98027c0bbb | 571 | * gps.attach_gga(foo, &FOO::myCallback); |
AjK | 0:db98027c0bbb | 572 | * |
AjK | 0:db98027c0bbb | 573 | * @endcode |
AjK | 0:db98027c0bbb | 574 | * |
AjK | 0:db98027c0bbb | 575 | * @ingroup API |
AjK | 0:db98027c0bbb | 576 | * @param tptr pointer to the object to call the member function on |
AjK | 0:db98027c0bbb | 577 | * @param mptr pointer to the member function to be called |
AjK | 0:db98027c0bbb | 578 | */ |
AjK | 0:db98027c0bbb | 579 | template<typename T> |
AjK | 0:db98027c0bbb | 580 | void attach_gga(T* tptr, void (T::*mptr)(void)) { cb_gga.attach(tptr, mptr); } |
AjK | 0:db98027c0bbb | 581 | |
AjK | 0:db98027c0bbb | 582 | //! Attach a user callback function to the NMEA GGA message processed signal. |
AjK | 0:db98027c0bbb | 583 | /** |
AjK | 0:db98027c0bbb | 584 | * Attach a user callback function pointer to call when an NMEA GGA packet has been processed. |
AjK | 0:db98027c0bbb | 585 | * |
AjK | 0:db98027c0bbb | 586 | * @code |
AjK | 0:db98027c0bbb | 587 | * void myCallback(void) { ... } |
AjK | 0:db98027c0bbb | 588 | * |
AjK | 0:db98027c0bbb | 589 | * GPS gps(NC, p9); |
AjK | 0:db98027c0bbb | 590 | * Foo foo; |
AjK | 0:db98027c0bbb | 591 | * |
AjK | 0:db98027c0bbb | 592 | * gps.attach_gga(&myCallback); |
AjK | 0:db98027c0bbb | 593 | * |
AjK | 0:db98027c0bbb | 594 | * @endcode |
AjK | 0:db98027c0bbb | 595 | * |
AjK | 0:db98027c0bbb | 596 | * @ingroup API |
AjK | 0:db98027c0bbb | 597 | * @param fptr Callback function pointer. |
AjK | 0:db98027c0bbb | 598 | */ |
AjK | 0:db98027c0bbb | 599 | void attach_gga(void (*fptr)(void)) { cb_gga.attach(fptr); } |
AjK | 0:db98027c0bbb | 600 | |
AjK | 0:db98027c0bbb | 601 | //! A callback object for the NMEA GGA message processed signal user API. |
AjK | 0:db98027c0bbb | 602 | FunctionPointer cb_gga; |
AjK | 0:db98027c0bbb | 603 | |
AjK | 0:db98027c0bbb | 604 | //! Set the baud rate the GPS module is using. |
AjK | 0:db98027c0bbb | 605 | /** |
AjK | 0:db98027c0bbb | 606 | * Set the baud rate of the serial port |
AjK | 0:db98027c0bbb | 607 | * |
AjK | 0:db98027c0bbb | 608 | * @see http://mbed.org/projects/libraries/api/mbed/trunk/Serial#Serial.baud |
AjK | 0:db98027c0bbb | 609 | * |
AjK | 0:db98027c0bbb | 610 | * @ingroup API |
AjK | 0:db98027c0bbb | 611 | * @param baudrate The baudrate to set. |
AjK | 0:db98027c0bbb | 612 | */ |
AjK | 0:db98027c0bbb | 613 | void baud(int baudrate) { Serial::baud(baudrate); } |
AjK | 0:db98027c0bbb | 614 | |
AjK | 0:db98027c0bbb | 615 | //! Set the serial port format the GPS module is using. |
AjK | 0:db98027c0bbb | 616 | /** |
AjK | 0:db98027c0bbb | 617 | * Set the transmission format used by the Serial port |
AjK | 0:db98027c0bbb | 618 | * |
AjK | 0:db98027c0bbb | 619 | * @see http://mbed.org/projects/libraries/api/mbed/trunk/Serial#Serial.format |
AjK | 0:db98027c0bbb | 620 | * |
AjK | 0:db98027c0bbb | 621 | * @ingroup API |
AjK | 0:db98027c0bbb | 622 | * @param bits - The number of bits in a word (5-8; default = 8) |
AjK | 0:db98027c0bbb | 623 | * @param parity - The parity used (GPS::None, GPS::Odd, GPS::Even, GPS::Forced1, GPS::Forced0; default = GPS::None) |
AjK | 0:db98027c0bbb | 624 | * @param stop_bits - The number of stop bits (1 or 2; default = 1) |
AjK | 0:db98027c0bbb | 625 | */ |
AjK | 0:db98027c0bbb | 626 | void format(int bits, Parity parity, int stop_bits) { Serial::format(bits, (Serial::Parity)parity, stop_bits); } |
AjK | 0:db98027c0bbb | 627 | |
AjK | 0:db98027c0bbb | 628 | protected: |
AjK | 0:db98027c0bbb | 629 | |
AjK | 0:db98027c0bbb | 630 | //! Flag set true when a GPS PPS has been attached to a pin. |
AjK | 0:db98027c0bbb | 631 | bool _ppsInUse; |
AjK | 0:db98027c0bbb | 632 | |
AjK | 0:db98027c0bbb | 633 | //! An InterruptIn object to "trigger" on the PPS edge. |
AjK | 0:db98027c0bbb | 634 | InterruptIn *_pps; |
AjK | 0:db98027c0bbb | 635 | |
AjK | 0:db98027c0bbb | 636 | //! A Ticker object called every 10ms. |
AjK | 0:db98027c0bbb | 637 | Ticker *_second100; |
AjK | 0:db98027c0bbb | 638 | |
AjK | 0:db98027c0bbb | 639 | //! A GPS_Time object used to hold the last parsed time/date data. |
AjK | 0:db98027c0bbb | 640 | GPS_Time theTime; |
AjK | 0:db98027c0bbb | 641 | |
AjK | 0:db98027c0bbb | 642 | //! A GPS_Geodetic object used to hold the last parsed positional data. |
AjK | 0:db98027c0bbb | 643 | GPS_Geodetic thePlace; |
AjK | 0:db98027c0bbb | 644 | }; |
AjK | 0:db98027c0bbb | 645 | |
AjK | 0:db98027c0bbb | 646 | #endif |
AjK | 0:db98027c0bbb | 647 |