LoRaWAN-Signal-Mapping/iot/main/gps.cpp

28 lines
534 B
C++

#include "gps.h"
#include "settings.h"
void gps_begin() {
serial_gps.begin(BAUD_GPS);
}
TinyGPSLocation gps_location() {
Serial.print("[gps] Getting location: ");
while(serial_gps.available() > 0) {
if(!gps.encode(serial_gps.read()))
continue;
if(!gps.location.isValid() || gis.location.isUpdated()) {
Serial.print(".");
delay(100);
continue;
}
Serial.println("ok");
return gps.location;
}
}
void gps_end() {
Serial.println(F("[warning] Putting the GPS device to sleep isn't implemented yet."));
}