2021-02-13 18:42:51 +02:00
|
|
|
#include <taskGPS.h>
|
2021-02-13 19:08:37 +02:00
|
|
|
#include "TTGO_T-Beam_LoRa_APRS_config.h"
|
2021-02-13 18:42:51 +02:00
|
|
|
|
|
|
|
// Pins for GPS
|
2021-02-13 19:08:37 +02:00
|
|
|
#ifdef T_BEAM_V1_0
|
|
|
|
static const int RXPin = 12, TXPin = 34;
|
|
|
|
#else
|
|
|
|
static const int RXPin = 15, TXPin = 12;
|
|
|
|
#endif
|
2021-02-13 18:42:51 +02:00
|
|
|
static const uint32_t GPSBaud = 9600; //GPS
|
|
|
|
HardwareSerial gpsSerial(1); // TTGO has HW serial
|
|
|
|
TinyGPSPlus gps; // The TinyGPS++ object
|
|
|
|
bool gpsInitialized = false;
|
|
|
|
|
|
|
|
void taskGPS(void *parameter) {
|
|
|
|
if (!gpsInitialized){
|
|
|
|
gpsSerial.begin(GPSBaud, SERIAL_8N1, TXPin, RXPin); //Startup HW serial for GPS
|
|
|
|
}
|
|
|
|
for (;;) {
|
|
|
|
while (gpsSerial.available() > 0) {
|
|
|
|
gps.encode(gpsSerial.read());
|
|
|
|
}
|
|
|
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
|
|
|
}
|
|
|
|
}
|