rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
nmea.h
Go to the documentation of this file.
1/**
2 *
3 * https://github.com/wdalmut/libgps/tree/develop/src
4 *
5 */
6
7#pragma once
8
9#include "rusefi_types.h"
10
11#define GPS_MAX_STRING 256
12
13typedef enum {
15 NMEA_GPRMC = 0x01,
16 NMEA_GPGGA = 0x02
18
19#define _EMPTY 0x00
20#define NMEA_GPRMC_STR "$GPRMC"
21#define NMEA_GPGGA_STR "$GPGGA"
22#define _COMPLETED 0x03
23
24#define NMEA_CHECKSUM_ERR 0x80
25#define NMEA_MESSAGE_ERR 0xC0
26
28 float latitude;
29 float longitude;
30 float speed;
31 float altitude;
32 float course;
37 char lat; // Northing Indicator N=North, S=South
38 char lon; // Easting Indicator E=East, W=West
39};
40typedef struct GPSlocation loc_t;
41
43int nmea_valid_checksum(const char *);
44
45
46void gps_location(loc_t *, char const * const);
47
48static int str2int(const char * a, const int len) {
49 int i = 0, k = 0;
50 while (i < len) {
51 k = (k << 3) + (k << 1) + (*a) - '0';
52 a++;
53 i++;
54 }
55 return k;
56}
static int str2int(const char *a, const int len)
Definition nmea.h:48
nmea_message_type nmea_get_message_type(const char *)
Definition nmea.cpp:259
nmea_message_type
Definition nmea.h:13
@ NMEA_UNKNOWN
Definition nmea.h:14
@ NMEA_GPGGA
Definition nmea.h:16
@ NMEA_GPRMC
Definition nmea.h:15
int nmea_valid_checksum(const char *)
Definition nmea.cpp:276
void gps_location(loc_t *, char const *const)
Definition nmea.cpp:298
char lat
Definition nmea.h:37
float altitude
Definition nmea.h:31
float latitude
Definition nmea.h:28
int satellites
Definition nmea.h:36
nmea_message_type type
Definition nmea.h:34
efidatetime_t time
Definition nmea.h:33
float course
Definition nmea.h:32
float longitude
Definition nmea.h:29
char lon
Definition nmea.h:38
int quality
Definition nmea.h:35
float speed
Definition nmea.h:30