Espruino/libs/misc/nmea.h
2019-11-06 13:09:52 +00:00

31 lines
978 B
C

/*
* This file is part of Espruino, a JavaScript interpreter for Microcontrollers
*
* Copyright (C) 2019 Gordon Williams <gw@pur3.co.uk>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* ----------------------------------------------------------------------------
* NMEA decoder
* ----------------------------------------------------------------------------
*/
#include "jsvar.h"
typedef struct {
double lat,lon,alt;
double speed, course;
int hour,min,sec,ms;
uint8_t day,month,year; // 1-base day, month and year (eg. as written)
uint8_t quality; // from GGA packet, 0 = no fix
uint8_t satellites; // how many satellites
} NMEAFixInfo;
#define NMEA_MAX_SIZE 82 // 82 is the max for NMEA
bool nmea_decode(NMEAFixInfo *gpsFix, const char *nmeaLine);
JsVar *nmea_to_jsVar(NMEAFixInfo *gpsFix);