123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- /*
- TinyGPS - a small GPS library for Arduino providing basic NMEA parsing
- Based on work by and "distance_to" and "course_to" courtesy of Maarten Lamers.
- Suggestion to add satellites(void), course_to(void), and cardinal(void), by Matt Monson.
- Precision improvements suggested by Wayne Holder.
- Copyright (C) 2008-2013 Mikal Hart
- All rights reserved.
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
- #ifndef TinyGPS_h
- #define TinyGPS_h
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <stdbool.h>
- #include <stdlib.h>
- #include <math.h>
- #include "stm32f4xx.h"
- #include "bexus_sysclock.h"
- #define _GPS_VERSION 13 // software version of this library
- #define _GPS_MPH_PER_KNOT 1.15077945
- #define _GPS_MPS_PER_KNOT 0.51444444
- #define _GPS_KMPH_PER_KNOT 1.852
- #define _GPS_MILES_PER_METER 0.00062137112
- #define _GPS_KM_PER_METER 0.001
- // #define _GPS_NO_STATS
- void setupTinyGps(void);
- enum {
- GPS_INVALID_AGE = -1, GPS_INVALID_ANGLE = 999999999,
- GPS_INVALID_ALTITUDE = 999999999, GPS_INVALID_DATE = 0,
- GPS_INVALID_TIME = -1, GPS_INVALID_SPEED = 999999999,
- GPS_INVALID_FIX_TIME = -1, GPS_INVALID_SATELLITES = 0xFF,
- GPS_INVALID_HDOP = -1
- };
- extern const float GPS_INVALID_F_ANGLE;
- extern const float GPS_INVALID_F_ALTITUDE;
- extern const float GPS_INVALID_F_SPEED;
- bool encode(char c); // process one character received from GPS
- // lat/long in MILLIONTHs of a degree and age of fix in milliseconds
- // (note: versions 12 and earlier gave lat/long in 100,000ths of a degree.
- void get_position(long *latitude, long *longitude, unsigned long *fix_age);
- // date as ddmmyy, time as hhmmsscc, and age in milliseconds
- void get_datetime(unsigned long *date, unsigned long *time, unsigned long *age);
- void f_get_position(float *latitude, float *longitude, unsigned long *fix_age);
- void crack_datetime(int *year, uint8_t *month, uint8_t *day,
- uint8_t *hour, uint8_t *minute, uint8_t *second, uint8_t *hundredths, unsigned long *fix_age);
- float f_altitude(void);
- float f_course(void);
- float f_speed_knots(void);
- float f_speed_mph(void);
- float f_speed_mps(void);
- float f_speed_kmph(void);
- static int library_version(void) { return _GPS_VERSION; }
- static const char *cardinal(float course);
- #ifndef _GPS_NO_STATS
- void stats(unsigned long *chars, unsigned short *good_sentences, unsigned short *failed_cs);
- #endif
- enum {_GPS_SENTENCE_GPGGA, _GPS_SENTENCE_GPRMC, _GPS_SENTENCE_OTHER};
- // parsing state variables
- extern uint8_t _parity;
- extern bool _is_checksum_term;
- extern char _term[15];
- extern uint8_t _sentence_type;
- extern uint8_t _term_number;
- extern uint8_t _term_offset;
- extern bool _gps_data_good;
- extern unsigned long _hdop;
- // signed altitude in centimeters (from GPGGA sentence)
- inline long altitude(void);
- // course in last full GPRMC sentence in 100th of a degree
- inline unsigned long course(void);
- // speed in last full GPRMC sentence in 100ths of a knot
- inline unsigned long speed(void);
- // satellites used in last full GPGGA sentence
- inline unsigned short satellites(void);
- // horizontal dilution of precision in 100ths
- inline unsigned long hdop(void);
- // internal utilities
-
- #ifdef __cplusplus
- }
- #endif
- #endif
|