Loading...
Searching...
No Matches
gps.h
1
9
10#ifndef _GPS_H
11#define _GPS_H
12
13#define GPS_PUBX_SILENCE \
14 "$PUBX,40,GLL,0,0,0,0,0,0*5C\r\n$PUBX,40,RMC,0,0,0,0,0,0*47\r\n$PUBX,40," \
15 "GSA,0,0,0,0,0,0*4E\r\n$PUBX,40,GSV,0,0,0,0,0,0*59\r\n$PUBX,40,GGA,0,0,0,0," \
16 "0,0*5A\r\n$PUBX,40,VTG,0,0,0,0,0,0*5E\r\n$PUBX,40,GSV,0,0,0,0,0,0*59\r\n"
17
18#define GPS_PUBX_POLL "$PUBX,00*33\r\n"
19
20#include "stm32f4xx.h"
21#include "stdint.h"
22#include "math.h"
23
24#include "devices.h"
25#include "uart.h"
26
31
32
33typedef struct GPS_Data {
34 //PUBX 00 message
35 char time[15];
36 uint8_t hour;
37 uint8_t minute;
38 uint8_t second;
39 char latitude[15];
40 char latitude_degrees;
41 float latitude_minutes;
42 char N_S[15];
43 char longitude[15];
44 char longitude_degrees;
45 float longitude_minutes;
46 char E_W[15];
47 char altref[15]; // Altitude above sea level
48 char navstat[3]; // Navigation status (NF = No Fix, DR = Dead Reckoning, G2 = 2D Fix, G3 = 3D Fix,D2 = 2D Differential, D3 = 3D Differential, RK = combined GPS + dead reckoning solution, TT = Time only solution)
49 char hacc[15]; // Horizontal accuracy estimate
50 char vacc[15]; // Vertical accuracy estimate
51 char sog[15]; // Speed over ground
52 char cog[15]; // Course over ground
53 char vvel[15]; // Vertical velocity
54 char diffage[15]; // Age of DGPS data
55 char hdop[15]; // Horizontal dilution of precision
56 char vdop[15]; // Vertical dilution of precision
57 char tdop[15]; // Time dilution of precision
58 char satellites[15]; // Number of satellites used
59 uint8_t lock; // 0 = no lock, 1 = lock
60} GPS_Data;
61
62typedef struct GPS {
63 UART base;
64 GPIO_TypeDef *port;
65 UART_Pins pins;
66 uint32_t baud;
67 void (*message)(struct GPS *, char *);
68 void (*decode)(struct GPS *, char *, struct GPS_Data *);
69} GPS;
70
71DeviceHandle_t GPS_init(GPS *, char *, USART_TypeDef *, GPIO_TypeDef *, UART_Pins, uint32_t);
72
73void GPS_message(GPS *, char *);
74void GPS_decode(GPS *, char *, struct GPS_Data *);
75
77#endif
Definition gps.h:62
Definition gps.h:33
Struct definition for UART interface.
Definition uart.h:53