First commit, working build.

This commit is contained in:
id101010
2015-12-03 00:35:33 +01:00
commit 95685224b5
26 changed files with 3112 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>
Adafruit_GPS GPS(&Serial1);
// Set GPSECHO to 'false' to turn off echoing the GPS data to the Serial console
// Set to 'true' if you want to debug and listen to the raw GPS sentences
#define GPSECHO true
// this keeps track of whether we're using the interrupt
// off by default!
boolean usingInterrupt = false;
void setup()
{
//while (!Serial);
// connect at 115200 so we can read the GPS fast enuf and
// also spit it out
Serial.begin(115200);
Serial.println("Adafruit GPS logging start test!");
// 9600 NMEA is the default baud rate for MTK - some use 4800
GPS.begin(9600);
// You can adjust which sentences to have the module emit, below
// Default is RMC + GGA
GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
// Default is 1 Hz update rate
GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);
// the nice thing about this code is you can have a timer0 interrupt go off
// every 1 millisecond, and read data from the GPS for you. that makes the
// loop code a heck of a lot easier!
useInterrupt(true);
delay(500);
while (true) {
Serial.print("Starting logging....");
if (GPS.LOCUS_StartLogger()) {
Serial.println(" STARTED!");
break;
} else {
Serial.println(" no response :(");
}
}
}
void loop() // run over and over again
{
pinMode(7, OUTPUT);
digitalWrite(7, HIGH);
delay(200);
digitalWrite(7, LOW);
delay(200);
}
/******************************************************************/
// Interrupt is called once a millisecond, looks for any new GPS data, and stores it
SIGNAL(TIMER0_COMPA_vect) {
char c = GPS.read();
// if you want to debug, this is a good time to do it!
if (GPSECHO)
if (c) Serial.print(c);
}
void useInterrupt(boolean v) {
if (v) {
// Timer0 is already used for millis() - we'll just interrupt somewhere
// in the middle and call the "Compare A" function above
OCR0A = 0xAF;
TIMSK0 |= _BV(OCIE0A);
usingInterrupt = true;
} else {
// do not call the interrupt function COMPA anymore
TIMSK0 &= ~_BV(OCIE0A);
usingInterrupt = false;
}
}