aboutsummaryrefslogtreecommitdiff
path: root/apps/gps/nmea_helper.h
blob: 8fd630bcd3822a4c8f495752c6f416f9cf86735f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * nmea_helper.h
 *
 *  Created on: Mar 15, 2012
 *      Author: thomasgubler
 */

#ifndef NMEA_H_
#define NMEA_H_

#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "nmealib/nmea/nmea.h"


//definitions for watchdog
#define NMEA_WATCHDOG_CRITICAL_TIME_MICROSECONDS 2000000
#define NMEA_WATCHDOG_WAIT_TIME_MICROSECONDS 800000

typedef struct {
	uint64_t last_message_timestamp;
}  __attribute__((__packed__)) type_gps_bin_nmea_state;

typedef type_gps_bin_nmea_state gps_bin_nmea_state_t;

extern gps_bin_nmea_state_t *nmea_state;
extern pthread_mutex_t *nmea_mutex;



int read_gps_nmea(int fd, char *gps_rx_buffer, int buffer_size, nmeaINFO *info, nmeaPARSER *parser);

void *nmea_loop(void *arg);

void *nmea_watchdog_loop(void *arg);

/**
 * \brief Convert NDEG (NMEA degree) to fractional degree
 */
float ndeg2degree(float val);

void nmea_init(void);


#endif /* NMEA_H_ */