Merge pull request #109 from adafruit/actions

Add Actions and remove travis
This commit is contained in:
Matt Goodrich 2020-01-17 21:33:03 -05:00 committed by GitHub
commit 309b27c464
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 540 additions and 473 deletions

32
.github/workflows/githubci.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Arduino Library CI
on: [pull_request, push, repository_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: adafruit/ci-arduino
path: ci
- name: pre-install
run: bash ci/actions_install.sh
- name: test platforms
run: python3 ci/build_platform.py main_platforms
- name: clang
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
- name: doxygen
env:
GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
PRETTYNAME : "Adafruit GPS Library"
run: bash ci/doxy_gen_and_deploy.sh

View File

@ -1,29 +0,0 @@
language: c
sudo: false
# Blacklist
branches:
except:
- gh-pages
cache:
directories:
- ~/arduino_ide
- ~/.arduino15/packages/
git:
depth: false
quiet: true
env:
global:
- PRETTYNAME="Adafruit GPS"
# Optional, will default to "$TRAVIS_BUILD_DIR/Doxyfile"
# - DOXYFILE: $TRAVIS_BUILD_DIR/Doxyfile
before_install:
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
script:
- build_main_platforms
# Generate and deploy documentation
after_success:
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/library_check.sh)
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_gen_and_deploy.sh)

File diff suppressed because it is too large Load Diff

View File

@ -26,107 +26,141 @@
#ifndef _ADAFRUIT_GPS_H #ifndef _ADAFRUIT_GPS_H
#define _ADAFRUIT_GPS_H #define _ADAFRUIT_GPS_H
#define USE_SW_SERIAL ///< comment this out if you don't want to include software serial in the library #define USE_SW_SERIAL ///< comment this out if you don't want to include
#define GPS_DEFAULT_I2C_ADDR 0x10 ///< The default address for I2C transport of GPS data ///< software serial in the library
#define GPS_MAX_I2C_TRANSFER 32 ///< The max number of bytes we'll try to read at once #define GPS_DEFAULT_I2C_ADDR \
#define GPS_MAX_SPI_TRANSFER 100 ///< The max number of bytes we'll try to read at once 0x10 ///< The default address for I2C transport of GPS data
#define GPS_MAX_I2C_TRANSFER \
32 ///< The max number of bytes we'll try to read at once
#define GPS_MAX_SPI_TRANSFER \
100 ///< The max number of bytes we'll try to read at once
#define MAXLINELENGTH 120 ///< how long are max NMEA lines to parse? #define MAXLINELENGTH 120 ///< how long are max NMEA lines to parse?
#define NMEA_MAX_SENTENCE_ID 20 ///< maximum length of a sentence ID name, including terminating 0 #define NMEA_MAX_SENTENCE_ID \
#define NMEA_MAX_SOURCE_ID 3 ///< maximum length of a source ID name, including terminating 0 20 ///< maximum length of a sentence ID name, including terminating 0
#define NMEA_MAX_SOURCE_ID \
3 ///< maximum length of a source ID name, including terminating 0
#include "Arduino.h" #include "Arduino.h"
#if (defined(__AVR__) || defined(ESP8266)) && defined(USE_SW_SERIAL) #if (defined(__AVR__) || defined(ESP8266)) && defined(USE_SW_SERIAL)
#include <SoftwareSerial.h> #include <SoftwareSerial.h>
#endif #endif
#include <Wire.h>
#include <SPI.h> #include <SPI.h>
#include <Wire.h>
/**************************************************************************/ /**************************************************************************/
/** /**
Different commands to set the update rate from once a second (1 Hz) to 10 times a second (10Hz) Different commands to set the update rate from once a second (1 Hz) to 10 times
Note that these only control the rate at which the position is echoed, to actually speed up the a second (10Hz) Note that these only control the rate at which the position is
position fix you must also send one of the position fix rate commands below too. */ echoed, to actually speed up the position fix you must also send one of the
#define PMTK_SET_NMEA_UPDATE_100_MILLIHERTZ "$PMTK220,10000*2F" ///< Once every 10 seconds, 100 millihertz. position fix rate commands below too. */
#define PMTK_SET_NMEA_UPDATE_200_MILLIHERTZ "$PMTK220,5000*1B" ///< Once every 5 seconds, 200 millihertz. #define PMTK_SET_NMEA_UPDATE_100_MILLIHERTZ \
#define PMTK_SET_NMEA_UPDATE_1HZ "$PMTK220,1000*1F" ///< 1 Hz "$PMTK220,10000*2F" ///< Once every 10 seconds, 100 millihertz.
#define PMTK_SET_NMEA_UPDATE_2HZ "$PMTK220,500*2B" ///< 2 Hz #define PMTK_SET_NMEA_UPDATE_200_MILLIHERTZ \
#define PMTK_SET_NMEA_UPDATE_5HZ "$PMTK220,200*2C" ///< 5 Hz "$PMTK220,5000*1B" ///< Once every 5 seconds, 200 millihertz.
#define PMTK_SET_NMEA_UPDATE_10HZ "$PMTK220,100*2F" ///< 10 Hz #define PMTK_SET_NMEA_UPDATE_1HZ "$PMTK220,1000*1F" ///< 1 Hz
#define PMTK_SET_NMEA_UPDATE_2HZ "$PMTK220,500*2B" ///< 2 Hz
#define PMTK_SET_NMEA_UPDATE_5HZ "$PMTK220,200*2C" ///< 5 Hz
#define PMTK_SET_NMEA_UPDATE_10HZ "$PMTK220,100*2F" ///< 10 Hz
// Position fix update rate commands. // Position fix update rate commands.
#define PMTK_API_SET_FIX_CTL_100_MILLIHERTZ "$PMTK300,10000,0,0,0,0*2C" ///< Once every 10 seconds, 100 millihertz. #define PMTK_API_SET_FIX_CTL_100_MILLIHERTZ \
#define PMTK_API_SET_FIX_CTL_200_MILLIHERTZ "$PMTK300,5000,0,0,0,0*18" ///< Once every 5 seconds, 200 millihertz. "$PMTK300,10000,0,0,0,0*2C" ///< Once every 10 seconds, 100 millihertz.
#define PMTK_API_SET_FIX_CTL_1HZ "$PMTK300,1000,0,0,0,0*1C" ///< 1 Hz #define PMTK_API_SET_FIX_CTL_200_MILLIHERTZ \
#define PMTK_API_SET_FIX_CTL_5HZ "$PMTK300,200,0,0,0,0*2F" ///< 5 Hz "$PMTK300,5000,0,0,0,0*18" ///< Once every 5 seconds, 200 millihertz.
#define PMTK_API_SET_FIX_CTL_1HZ "$PMTK300,1000,0,0,0,0*1C" ///< 1 Hz
#define PMTK_API_SET_FIX_CTL_5HZ "$PMTK300,200,0,0,0,0*2F" ///< 5 Hz
// Can't fix position faster than 5 times a second! // Can't fix position faster than 5 times a second!
#define PMTK_SET_BAUD_115200 "$PMTK251,115200*1F" ///< 115200 bps #define PMTK_SET_BAUD_115200 "$PMTK251,115200*1F" ///< 115200 bps
#define PMTK_SET_BAUD_57600 "$PMTK251,57600*2C" ///< 57600 bps #define PMTK_SET_BAUD_57600 "$PMTK251,57600*2C" ///< 57600 bps
#define PMTK_SET_BAUD_9600 "$PMTK251,9600*17" ///< 9600 bps #define PMTK_SET_BAUD_9600 "$PMTK251,9600*17" ///< 9600 bps
#define PMTK_SET_NMEA_OUTPUT_GLLONLY "$PMTK314,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on only the GPGLL sentence #define PMTK_SET_NMEA_OUTPUT_GLLONLY \
#define PMTK_SET_NMEA_OUTPUT_RMCONLY "$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on only the GPRMC sentence "$PMTK314,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on only the
#define PMTK_SET_NMEA_OUTPUT_VTGONLY "$PMTK314,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on only the GPVTG ///< GPGLL sentence
#define PMTK_SET_NMEA_OUTPUT_GGAONLY "$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on just the GPGGA #define PMTK_SET_NMEA_OUTPUT_RMCONLY \
#define PMTK_SET_NMEA_OUTPUT_GSAONLY "$PMTK314,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on just the GPGSA "$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on only the
#define PMTK_SET_NMEA_OUTPUT_GSVONLY "$PMTK314,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on just the GPGSV ///< GPRMC sentence
#define PMTK_SET_NMEA_OUTPUT_RMCGGA "$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28" ///< turn on GPRMC and GPGGA #define PMTK_SET_NMEA_OUTPUT_VTGONLY \
#define PMTK_SET_NMEA_OUTPUT_RMCGGAGSA "$PMTK314,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on GPRMC, GPGGA and GPGSA "$PMTK314,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on only the
#define PMTK_SET_NMEA_OUTPUT_ALLDATA "$PMTK314,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0*28" ///< turn on ALL THE DATA ///< GPVTG
#define PMTK_SET_NMEA_OUTPUT_OFF "$PMTK314,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28" ///< turn off output #define PMTK_SET_NMEA_OUTPUT_GGAONLY \
"$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on just the
///< GPGGA
#define PMTK_SET_NMEA_OUTPUT_GSAONLY \
"$PMTK314,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on just the
///< GPGSA
#define PMTK_SET_NMEA_OUTPUT_GSVONLY \
"$PMTK314,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on just the
///< GPGSV
#define PMTK_SET_NMEA_OUTPUT_RMCGGA \
"$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28" ///< turn on GPRMC and
///< GPGGA
#define PMTK_SET_NMEA_OUTPUT_RMCGGAGSA \
"$PMTK314,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on GPRMC, GPGGA
///< and GPGSA
#define PMTK_SET_NMEA_OUTPUT_ALLDATA \
"$PMTK314,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0*28" ///< turn on ALL THE DATA
#define PMTK_SET_NMEA_OUTPUT_OFF \
"$PMTK314,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28" ///< turn off output
// to generate your own sentences, check out the MTK command datasheet and use a
// checksum calculator such as the awesome
// http://www.hhhh.org/wiml/proj/nmeaxor.html
// to generate your own sentences, check out the MTK command datasheet and use a checksum calculator #define PMTK_LOCUS_STARTLOG "$PMTK185,0*22" ///< Start logging data
// such as the awesome http://www.hhhh.org/wiml/proj/nmeaxor.html #define PMTK_LOCUS_STOPLOG "$PMTK185,1*23" ///< Stop logging data
#define PMTK_LOCUS_STARTSTOPACK \
"$PMTK001,185,3*3C" ///< Acknowledge the start or stop command
#define PMTK_LOCUS_QUERY_STATUS "$PMTK183*38" ///< Query the logging status
#define PMTK_LOCUS_ERASE_FLASH "$PMTK184,1*22" ///< Erase the log flash data
#define LOCUS_OVERLAP \
0 ///< If flash is full, log will overwrite old data with new logs
#define LOCUS_FULLSTOP 1 ///< If flash is full, logging will stop
#define PMTK_LOCUS_STARTLOG "$PMTK185,0*22" ///< Start logging data #define PMTK_ENABLE_SBAS \
#define PMTK_LOCUS_STOPLOG "$PMTK185,1*23" ///< Stop logging data "$PMTK313,1*2E" ///< Enable search for SBAS satellite (only works with 1Hz
#define PMTK_LOCUS_STARTSTOPACK "$PMTK001,185,3*3C" ///< Acknowledge the start or stop command ///< output rate)
#define PMTK_LOCUS_QUERY_STATUS "$PMTK183*38" ///< Query the logging status #define PMTK_ENABLE_WAAS "$PMTK301,2*2E" ///< Use WAAS for DGPS correction data
#define PMTK_LOCUS_ERASE_FLASH "$PMTK184,1*22" ///< Erase the log flash data
#define LOCUS_OVERLAP 0 ///< If flash is full, log will overwrite old data with new logs
#define LOCUS_FULLSTOP 1 ///< If flash is full, logging will stop
#define PMTK_ENABLE_SBAS "$PMTK313,1*2E" ///< Enable search for SBAS satellite (only works with 1Hz output rate) #define PMTK_STANDBY \
#define PMTK_ENABLE_WAAS "$PMTK301,2*2E" ///< Use WAAS for DGPS correction data "$PMTK161,0*28" ///< standby command & boot successful message
#define PMTK_STANDBY_SUCCESS "$PMTK001,161,3*36" ///< Not needed currently
#define PMTK_AWAKE "$PMTK010,002*2D" ///< Wake up
#define PMTK_STANDBY "$PMTK161,0*28" ///< standby command & boot successful message #define PMTK_Q_RELEASE "$PMTK605*31" ///< ask for the release and version
#define PMTK_STANDBY_SUCCESS "$PMTK001,161,3*36" ///< Not needed currently
#define PMTK_AWAKE "$PMTK010,002*2D" ///< Wake up
#define PMTK_Q_RELEASE "$PMTK605*31" ///< ask for the release and version #define PGCMD_ANTENNA \
"$PGCMD,33,1*6C" ///< request for updates on antenna status
#define PGCMD_NOANTENNA "$PGCMD,33,0*6D" ///< don't show antenna status messages
#define MAXWAITSENTENCE \
#define PGCMD_ANTENNA "$PGCMD,33,1*6C" ///< request for updates on antenna status 10 ///< how long to wait when we're looking for a response
#define PGCMD_NOANTENNA "$PGCMD,33,0*6D" ///< don't show antenna status messages
#define MAXWAITSENTENCE 10 ///< how long to wait when we're looking for a response
/**************************************************************************/ /**************************************************************************/
/// type for resulting code from running check() /// type for resulting code from running check()
typedef enum { typedef enum {
NMEA_BAD = 0, ///< passed none of the checks NMEA_BAD = 0, ///< passed none of the checks
NMEA_HAS_DOLLAR = 1, ///< has a dollar sign in the first position NMEA_HAS_DOLLAR = 1, ///< has a dollar sign in the first position
NMEA_HAS_CHECKSUM = 2, ///< has a valid checksum at the end NMEA_HAS_CHECKSUM = 2, ///< has a valid checksum at the end
NMEA_HAS_NAME = 4, ///< there is a token after the $ followed by a comma NMEA_HAS_NAME = 4, ///< there is a token after the $ followed by a comma
NMEA_HAS_SOURCE = 10, ///< has a recognized source ID NMEA_HAS_SOURCE = 10, ///< has a recognized source ID
NMEA_HAS_SENTENCE = 20, ///< has a recognized sentence ID NMEA_HAS_SENTENCE = 20, ///< has a recognized sentence ID
NMEA_HAS_SENTENCE_P = 40 ///< has a recognized parseable sentence ID NMEA_HAS_SENTENCE_P = 40 ///< has a recognized parseable sentence ID
} nmea_check_t; } nmea_check_t;
/**************************************************************************/ /**************************************************************************/
/*! /*!
@brief The GPS class @brief The GPS class
*/ */
class Adafruit_GPS : public Print{ class Adafruit_GPS : public Print {
public: public:
bool begin(uint32_t baud_or_i2caddr); bool begin(uint32_t baud_or_i2caddr);
#if (defined(__AVR__) || defined(ESP8266)) && defined(USE_SW_SERIAL) #if (defined(__AVR__) || defined(ESP8266)) && defined(USE_SW_SERIAL)
Adafruit_GPS(SoftwareSerial *ser); // Constructor when using SoftwareSerial Adafruit_GPS(SoftwareSerial *ser); // Constructor when using SoftwareSerial
#endif #endif
Adafruit_GPS(HardwareSerial *ser); // Constructor when using HardwareSerial Adafruit_GPS(HardwareSerial *ser); // Constructor when using HardwareSerial
Adafruit_GPS(TwoWire *theWire); // Constructor when using I2C Adafruit_GPS(TwoWire *theWire); // Constructor when using I2C
Adafruit_GPS(SPIClass *theSPI, int8_t cspin); // Constructor when using SPI Adafruit_GPS(SPIClass *theSPI, int8_t cspin); // Constructor when using SPI
char *lastNMEA(void); char *lastNMEA(void);
@ -143,7 +177,7 @@ class Adafruit_GPS : public Print{
size_t write(uint8_t); size_t write(uint8_t);
size_t available(void); size_t available(void);
boolean check(char *nmea); boolean check(char *nmea);
boolean parse(char *); boolean parse(char *);
void addChecksum(char *buff); void addChecksum(char *buff);
float secondsSinceFix(); float secondsSinceFix();
@ -153,65 +187,78 @@ class Adafruit_GPS : public Print{
boolean wakeup(void); boolean wakeup(void);
boolean standby(void); boolean standby(void);
int thisCheck = 0; ///< the results of the check on the current sentence int thisCheck = 0; ///< the results of the check on the current sentence
char thisSource[NMEA_MAX_SOURCE_ID] = {0}; ///< the first two letters of the current sentence, e.g. WI, GP char thisSource[NMEA_MAX_SOURCE_ID] = {
char thisSentence[NMEA_MAX_SENTENCE_ID] = {0}; ///< the next three letters of the current sentence, e.g. GLL, RMC 0}; ///< the first two letters of the current sentence, e.g. WI, GP
char lastSource[NMEA_MAX_SOURCE_ID] = {0}; ///< the results of the check on the most recent successfully parsed sentence char thisSentence[NMEA_MAX_SENTENCE_ID] = {
char lastSentence[NMEA_MAX_SENTENCE_ID] = {0}; ///< the next three letters of the most recent successfully parsed sentence, e.g. GLL, RMC 0}; ///< the next three letters of the current sentence, e.g. GLL, RMC
char lastSource[NMEA_MAX_SOURCE_ID] = {
0}; ///< the results of the check on the most recent successfully parsed
///< sentence
char lastSentence[NMEA_MAX_SENTENCE_ID] = {
0}; ///< the next three letters of the most recent successfully parsed
///< sentence, e.g. GLL, RMC
uint8_t hour; ///< GMT hours uint8_t hour; ///< GMT hours
uint8_t minute; ///< GMT minutes uint8_t minute; ///< GMT minutes
uint8_t seconds; ///< GMT seconds uint8_t seconds; ///< GMT seconds
uint16_t milliseconds; ///< GMT milliseconds uint16_t milliseconds; ///< GMT milliseconds
uint8_t year; ///< GMT year uint8_t year; ///< GMT year
uint8_t month; ///< GMT month uint8_t month; ///< GMT month
uint8_t day; ///< GMT day uint8_t day; ///< GMT day
float latitude; ///< Floating point latitude value in degrees/minutes as received from the GPS (DDMM.MMMM) float latitude; ///< Floating point latitude value in degrees/minutes as
float longitude; ///< Floating point longitude value in degrees/minutes as received from the GPS (DDDMM.MMMM) ///< received from the GPS (DDMM.MMMM)
float longitude; ///< Floating point longitude value in degrees/minutes as
///< received from the GPS (DDDMM.MMMM)
/** Fixed point latitude and longitude value with degrees stored in units of 1/100000 degrees, /** Fixed point latitude and longitude value with degrees stored in units of
and minutes stored in units of 1/100000 degrees. See pull #13 for more details: 1/100000 degrees, and minutes stored in units of 1/100000 degrees. See pull
#13 for more details:
https://github.com/adafruit/Adafruit-GPS-Library/pull/13 */ https://github.com/adafruit/Adafruit-GPS-Library/pull/13 */
int32_t latitude_fixed; ///< Fixed point latitude in decimal degrees int32_t latitude_fixed; ///< Fixed point latitude in decimal degrees
int32_t longitude_fixed; ///< Fixed point longitude in decimal degrees int32_t longitude_fixed; ///< Fixed point longitude in decimal degrees
float latitudeDegrees; ///< Latitude in decimal degrees float latitudeDegrees; ///< Latitude in decimal degrees
float longitudeDegrees; ///< Longitude in decimal degrees float longitudeDegrees; ///< Longitude in decimal degrees
float geoidheight; ///< Diff between geoid height and WGS84 height float geoidheight; ///< Diff between geoid height and WGS84 height
float altitude; ///< Altitude in meters above MSL float altitude; ///< Altitude in meters above MSL
float speed; ///< Current speed over ground in knots float speed; ///< Current speed over ground in knots
float angle; ///< Course in degrees from true north float angle; ///< Course in degrees from true north
float magvariation; ///< Magnetic variation in degrees (vs. true north) float magvariation; ///< Magnetic variation in degrees (vs. true north)
float HDOP; ///< Horizontal Dilution of Precision - relative accuracy of horizontal position float HDOP; ///< Horizontal Dilution of Precision - relative accuracy of
float VDOP; ///< Vertical Dilution of Precision - relative accuracy of vertical position ///< horizontal position
float PDOP; ///< Position Dilution of Precision - Complex maths derives a simple, single number for each kind of DOP float VDOP; ///< Vertical Dilution of Precision - relative accuracy of
char lat; ///< N/S ///< vertical position
char lon; ///< E/W float PDOP; ///< Position Dilution of Precision - Complex maths derives a
char mag; ///< Magnetic variation direction ///< simple, single number for each kind of DOP
boolean fix; ///< Have a fix? char lat; ///< N/S
uint8_t fixquality; ///< Fix quality (0, 1, 2 = Invalid, GPS, DGPS) char lon; ///< E/W
uint8_t fixquality_3d; ///< 3D fix quality (1, 3, 3 = Nofix, 2D fix, 3D fix) char mag; ///< Magnetic variation direction
uint8_t satellites; ///< Number of satellites in use boolean fix; ///< Have a fix?
uint8_t fixquality; ///< Fix quality (0, 1, 2 = Invalid, GPS, DGPS)
uint8_t fixquality_3d; ///< 3D fix quality (1, 3, 3 = Nofix, 2D fix, 3D fix)
uint8_t satellites; ///< Number of satellites in use
boolean waitForSentence(const char *wait, uint8_t max = MAXWAITSENTENCE, boolean usingInterrupts = false); boolean waitForSentence(const char *wait, uint8_t max = MAXWAITSENTENCE,
boolean usingInterrupts = false);
boolean LOCUS_StartLogger(void); boolean LOCUS_StartLogger(void);
boolean LOCUS_StopLogger(void); boolean LOCUS_StopLogger(void);
boolean LOCUS_ReadStatus(void); boolean LOCUS_ReadStatus(void);
uint16_t LOCUS_serial; ///< Log serial number uint16_t LOCUS_serial; ///< Log serial number
uint16_t LOCUS_records; ///< Log number of data record uint16_t LOCUS_records; ///< Log number of data record
uint8_t LOCUS_type; ///< Log type, 0: Overlap, 1: FullStop uint8_t LOCUS_type; ///< Log type, 0: Overlap, 1: FullStop
uint8_t LOCUS_mode; ///< Logging mode, 0x08 interval logger uint8_t LOCUS_mode; ///< Logging mode, 0x08 interval logger
uint8_t LOCUS_config; ///< Contents of configuration uint8_t LOCUS_config; ///< Contents of configuration
uint8_t LOCUS_interval; ///< Interval setting uint8_t LOCUS_interval; ///< Interval setting
uint8_t LOCUS_distance; ///< Distance setting uint8_t LOCUS_distance; ///< Distance setting
uint8_t LOCUS_speed; ///< Speed setting uint8_t LOCUS_speed; ///< Speed setting
uint8_t LOCUS_status; ///< 0: Logging, 1: Stop logging uint8_t LOCUS_status; ///< 0: Logging, 1: Stop logging
uint8_t LOCUS_percent; ///< Log life used percentage uint8_t LOCUS_percent; ///< Log life used percentage
private: private:
const char * tokenOnList(char *token, const char **list); const char *tokenOnList(char *token, const char **list);
void parseTime(char *); void parseTime(char *);
void parseLat(char *); void parseLat(char *);
boolean parseLatDir(char *); boolean parseLatDir(char *);
@ -219,18 +266,24 @@ class Adafruit_GPS : public Print{
boolean parseLonDir(char *); boolean parseLonDir(char *);
boolean parseFix(char *); boolean parseFix(char *);
// used by check() for validity tests, room for future expansion // used by check() for validity tests, room for future expansion
const char *sources[5] = {"II", "WI", "GP", "GN", "ZZZ"}; ///< valid source ids const char *sources[5] = {"II", "WI", "GP", "GN",
const char *sentences_parsed[5] = {"GGA", "GLL", "GSA", "RMC", "ZZZ"}; ///< parseable sentence ids "ZZZ"}; ///< valid source ids
const char *sentences_known[1] = {"ZZZ"}; ///< known, but not parseable sentence ids const char *sentences_parsed[5] = {"GGA", "GLL", "GSA", "RMC",
"ZZZ"}; ///< parseable sentence ids
// Make all of these times far in the past by setting them near the middle of the const char *sentences_known[1] = {
// millis() range. Timing assumes that sentences are parsed promptly. "ZZZ"}; ///< known, but not parseable sentence ids
uint32_t lastUpdate = 2000000000L; ///< millis() when last full sentence successfully parsed
uint32_t lastFix = 2000000000L; ///< millis() when last fix received // Make all of these times far in the past by setting them near the middle of
uint32_t lastTime = 2000000000L; ///< millis() when last time received // the millis() range. Timing assumes that sentences are parsed promptly.
uint32_t lastDate = 2000000000L; ///< millis() when last date received uint32_t lastUpdate =
uint32_t recvdTime = 2000000000L; ///< millis() when last full sentence received 2000000000L; ///< millis() when last full sentence successfully parsed
uint32_t sentTime = 2000000000L; ///< millis() when first character of last full sentence received uint32_t lastFix = 2000000000L; ///< millis() when last fix received
uint32_t lastTime = 2000000000L; ///< millis() when last time received
uint32_t lastDate = 2000000000L; ///< millis() when last date received
uint32_t recvdTime =
2000000000L; ///< millis() when last full sentence received
uint32_t sentTime = 2000000000L; ///< millis() when first character of last
///< full sentence received
boolean paused; boolean paused;
uint8_t parseResponse(char *response); uint8_t parseResponse(char *response);
@ -241,20 +294,23 @@ class Adafruit_GPS : public Print{
TwoWire *gpsI2C; TwoWire *gpsI2C;
SPIClass *gpsSPI; SPIClass *gpsSPI;
int8_t gpsSPI_cs = -1; int8_t gpsSPI_cs = -1;
SPISettings gpsSPI_settings = SPISettings(1000000, MSBFIRST, SPI_MODE0); // default SPISettings gpsSPI_settings =
char _spibuffer[GPS_MAX_SPI_TRANSFER]; // for when we write data, we need to read it too! SPISettings(1000000, MSBFIRST, SPI_MODE0); // default
char _spibuffer[GPS_MAX_SPI_TRANSFER]; // for when we write data, we need to
// read it too!
uint8_t _i2caddr; uint8_t _i2caddr;
char _i2cbuffer[GPS_MAX_I2C_TRANSFER]; char _i2cbuffer[GPS_MAX_I2C_TRANSFER];
int8_t _buff_max = -1, _buff_idx = 0; int8_t _buff_max = -1, _buff_idx = 0;
char last_char = 0; char last_char = 0;
volatile char line1[MAXLINELENGTH]; ///< We double buffer: read one line in and leave one for the main program volatile char line1[MAXLINELENGTH]; ///< We double buffer: read one line in
///< and leave one for the main program
volatile char line2[MAXLINELENGTH]; ///< Second buffer volatile char line2[MAXLINELENGTH]; ///< Second buffer
volatile uint8_t lineidx=0; ///< our index into filling the current line volatile uint8_t lineidx = 0; ///< our index into filling the current line
volatile char *currentline; ///< Pointer to current line buffer volatile char *currentline; ///< Pointer to current line buffer
volatile char *lastline; ///< Pointer to previous line buffer volatile char *lastline; ///< Pointer to previous line buffer
volatile boolean recvdflag; ///< Received flag volatile boolean recvdflag; ///< Received flag
volatile boolean inStandbyMode; ///< In standby flag volatile boolean inStandbyMode; ///< In standby flag
}; };
/**************************************************************************/ /**************************************************************************/

View File

@ -7,3 +7,4 @@ paragraph=An interrupt-based GPS library for no-parsing-required use
category=Sensors category=Sensors
url=https://github.com/adafruit/Adafruit_GPS url=https://github.com/adafruit/Adafruit_GPS
architectures=* architectures=*
depends=SD