Added Standby and Wakeup fuctions for powering down and powering back up the GPS

This commit is contained in:
Austin St. Aubin 2012-04-29 20:46:21 -05:00
parent bd99b452fd
commit 80f869ce8a
1 changed files with 25 additions and 0 deletions

View File

@ -24,6 +24,7 @@ volatile uint8_t lineidx=0;
volatile char *currentline;
volatile char *lastline;
volatile boolean recvdflag;
volatile boolean inStandbyMode;
boolean Adafruit_GPS::parse(char *nmea) {
@ -344,3 +345,27 @@ boolean Adafruit_GPS::LOCUS_ReadStatus(void) {
return true;
}
// Standby Mode Switches
boolean Adafruit_GPS::standby(void) {
if (inStandbyMode) {
return false; // Returns false if already in standby mode, so that you do not wake it up by sending commands to GPS
}
else {
inStandbyMode = true;
sendCommand(PMTK_STANDBY);
//return waitForSentence(PMTK_STANDBY_SUCCESS); // don't seem to be fast enough to catch the message, or something else just is not working
return true;
}
}
boolean Adafruit_GPS::wakeup(void) {
if (inStandbyMode) {
inStandbyMode = false;
sendCommand(""); // send byte to wake it up
return waitForSentence(PMTK_AWAKE);
}
else {
return false; // Returns false if not in standby mode, nothing to wakeup
}
}