pulled interrupt stuff to sketch

This commit is contained in:
Ladyada 2012-03-27 18:20:41 -04:00
parent b05dacafad
commit ad4df7f289
2 changed files with 7 additions and 33 deletions

View File

@ -13,9 +13,6 @@ All text above must be included in any redistribution
#include <Adafruit_GPS.h> #include <Adafruit_GPS.h>
Adafruit_GPS GPS;
// we double buffer: read one line in and leave one for the main program // we double buffer: read one line in and leave one for the main program
volatile char line1[MAXLINELENGTH]; volatile char line1[MAXLINELENGTH];
volatile char line2[MAXLINELENGTH]; volatile char line2[MAXLINELENGTH];
@ -27,19 +24,6 @@ volatile char *lastline;
volatile boolean recvdflag; volatile boolean recvdflag;
// a ticker to divide out 1ms rate to 10ms period instead
static volatile uint8_t compA_Ticker = 0;
#define compA_MAX 1
SIGNAL(TIMER0_COMPA_vect) {
compA_Ticker++;
if (compA_Ticker < compA_MAX)
return;
compA_Ticker = 0;
GPS.read();
}
boolean Adafruit_GPS::parse(char *nmea) { boolean Adafruit_GPS::parse(char *nmea) {
// look for a few common sentences // look for a few common sentences
@ -218,18 +202,13 @@ Adafruit_GPS::Adafruit_GPS(void) {
lineidx = 0; lineidx = 0;
currentline = line1; currentline = line1;
lastline = line2; lastline = line2;
interrupt = false; // do not use interrupt!
} hour = minute = seconds = year = month = day = milliseconds = 0;
latitude = longitude = geoidheight = altitude = 0;
void Adafruit_GPS::interruptReads(boolean r) { speed = angle = magvariation = HDOP = 0;
interrupt = r; lat = lon = mag = 0;
if (interrupt) { fix = false;
OCR0A = 0x10; fixquality = satellites = 0;
TIMSK0 |= _BV(OCIE0A);
} else {
TIMSK0 &= ~_BV(OCIE0A);
}
compA_Ticker = 0;
} }
// Constructor when using SoftwareSerial or NewSoftSerial // Constructor when using SoftwareSerial or NewSoftSerial

View File

@ -77,7 +77,6 @@ class Adafruit_GPS {
private: private:
boolean paused; boolean paused;
boolean interrupt;
uint8_t parseResponse(char *response); uint8_t parseResponse(char *response);
#if ARDUINO >= 100 #if ARDUINO >= 100
@ -89,8 +88,4 @@ class Adafruit_GPS {
}; };
extern Adafruit_GPS GPS;
#endif #endif