Dependencies:   ChaNFSSD mbed BMP085 SHT2x

Committer:
tosihisa
Date:
Mon Feb 27 16:20:15 2012 +0000
Revision:
9:9ca3db7ed7cb
Parent:
1:83960ee4d9a2
V0.89.2. GPS recv data is OK.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tosihisa 1:83960ee4d9a2 1 /*
tosihisa 1:83960ee4d9a2 2 * Copyright (c) 2011 Toshihisa T
tosihisa 1:83960ee4d9a2 3 * Released under the MIT License: http://mbed.org/license/mit
tosihisa 1:83960ee4d9a2 4 */
tosihisa 0:6089ae824f06 5
tosihisa 0:6089ae824f06 6 #ifndef _NMEA_PARSE_H
tosihisa 0:6089ae824f06 7 #define _NMEA_PARSE_H
tosihisa 0:6089ae824f06 8 #ifdef __cplusplus
tosihisa 0:6089ae824f06 9 extern "C" {
tosihisa 0:6089ae824f06 10 #endif
tosihisa 0:6089ae824f06 11
tosihisa 0:6089ae824f06 12 #define LIBNMEA_PARSE_NONE (0)
tosihisa 0:6089ae824f06 13 #define LIBNMEA_PARSE_SUMOK (10)
tosihisa 0:6089ae824f06 14 #define LIBNMEA_PARSE_COMPLETE (100)
tosihisa 0:6089ae824f06 15
tosihisa 0:6089ae824f06 16 #define LIBNMEA_NUMSOFARRAY(array) (sizeof((array))/sizeof((array)[0]))
tosihisa 0:6089ae824f06 17
tosihisa 0:6089ae824f06 18 typedef double libNMEA_realnum_t;
tosihisa 0:6089ae824f06 19 typedef long libNMEA_intnum_t;
tosihisa 0:6089ae824f06 20
tosihisa 0:6089ae824f06 21 typedef struct {
tosihisa 0:6089ae824f06 22 // unsigned char isValid;
tosihisa 0:6089ae824f06 23 unsigned char active; /* '0' or '1' = Fix not available,'2' = 2D,'3' = 3D */
tosihisa 0:6089ae824f06 24 unsigned char positioning; /* 'A' = 単独測位,D = DGPS,N = 無効 */
tosihisa 0:6089ae824f06 25 } libNMEA_gps_status_t;
tosihisa 0:6089ae824f06 26
tosihisa 0:6089ae824f06 27 typedef struct {
tosihisa 0:6089ae824f06 28 unsigned long res1:1;
tosihisa 0:6089ae824f06 29 unsigned long year:12;
tosihisa 0:6089ae824f06 30 unsigned long mon:4;
tosihisa 0:6089ae824f06 31 unsigned long day:6;
tosihisa 0:6089ae824f06 32 unsigned long res2:9;
tosihisa 0:6089ae824f06 33 } libNMEA_gps_date_t;
tosihisa 0:6089ae824f06 34
tosihisa 0:6089ae824f06 35 typedef struct {
tosihisa 0:6089ae824f06 36 unsigned long res:1;
tosihisa 0:6089ae824f06 37 unsigned long hour:5;
tosihisa 0:6089ae824f06 38 unsigned long min:6;
tosihisa 0:6089ae824f06 39 unsigned long sec:6;
tosihisa 0:6089ae824f06 40 unsigned long msec:14;
tosihisa 0:6089ae824f06 41 } libNMEA_gps_time_t;
tosihisa 0:6089ae824f06 42
tosihisa 0:6089ae824f06 43 typedef struct {
tosihisa 0:6089ae824f06 44 // unsigned char isValid;
tosihisa 0:6089ae824f06 45 unsigned char unit;
tosihisa 0:6089ae824f06 46 libNMEA_realnum_t deg;
tosihisa 0:6089ae824f06 47 } libNMEA_gps_deg_t;
tosihisa 0:6089ae824f06 48
tosihisa 0:6089ae824f06 49 typedef struct {
tosihisa 0:6089ae824f06 50 unsigned char lat_unit; /* 'N'(Nouth) or 'S'(South) */
tosihisa 0:6089ae824f06 51 unsigned char lon_unit; /* 'W'(West) or 'E'(East) */
tosihisa 0:6089ae824f06 52 libNMEA_realnum_t latitude;
tosihisa 0:6089ae824f06 53 libNMEA_realnum_t longitude;
tosihisa 0:6089ae824f06 54 } libNMEA_gps_latlon_t;
tosihisa 0:6089ae824f06 55
tosihisa 0:6089ae824f06 56 typedef struct {
tosihisa 0:6089ae824f06 57 // unsigned char isValid;
tosihisa 0:6089ae824f06 58 libNMEA_realnum_t ground;
tosihisa 0:6089ae824f06 59 } libNMEA_gps_speed_t;
tosihisa 0:6089ae824f06 60
tosihisa 0:6089ae824f06 61 typedef struct {
tosihisa 0:6089ae824f06 62 // unsigned char isValid;
tosihisa 0:6089ae824f06 63 libNMEA_realnum_t dop;
tosihisa 0:6089ae824f06 64 } libNMEA_gps_dop_t;
tosihisa 0:6089ae824f06 65
tosihisa 0:6089ae824f06 66 typedef struct {
tosihisa 0:6089ae824f06 67 libNMEA_gps_deg_t trueNorth;
tosihisa 0:6089ae824f06 68 libNMEA_gps_deg_t magnetic;
tosihisa 0:6089ae824f06 69 libNMEA_gps_deg_t mag_dec;
tosihisa 0:6089ae824f06 70 } libNMEA_gps_direction_t;
tosihisa 0:6089ae824f06 71
tosihisa 0:6089ae824f06 72 typedef struct {
tosihisa 0:6089ae824f06 73 libNMEA_gps_dop_t h;
tosihisa 0:6089ae824f06 74 libNMEA_gps_dop_t v;
tosihisa 0:6089ae824f06 75 libNMEA_gps_dop_t p;
tosihisa 0:6089ae824f06 76 } libNMEA_gps_accuracy_t;
tosihisa 0:6089ae824f06 77
tosihisa 0:6089ae824f06 78 typedef struct {
tosihisa 0:6089ae824f06 79 unsigned long status:1; /* これが1ならば,GPS のデータを信用する */
tosihisa 0:6089ae824f06 80 unsigned long active:1;
tosihisa 0:6089ae824f06 81 unsigned long positioning:1;
tosihisa 0:6089ae824f06 82 unsigned long date:1;
tosihisa 0:6089ae824f06 83 unsigned long timeRMC:1;
tosihisa 0:6089ae824f06 84 unsigned long timeZDA:1;
tosihisa 0:6089ae824f06 85 unsigned long latitude:1;
tosihisa 0:6089ae824f06 86 unsigned long longitude:1;
tosihisa 0:6089ae824f06 87 unsigned long speed:1;
tosihisa 0:6089ae824f06 88 unsigned long direction:1;
tosihisa 0:6089ae824f06 89 unsigned long accuracy_hdop:1;
tosihisa 0:6089ae824f06 90 unsigned long accuracy_vdop:1;
tosihisa 0:6089ae824f06 91 unsigned long accuracy_pdop:1;
tosihisa 0:6089ae824f06 92 unsigned long res:19;
tosihisa 0:6089ae824f06 93 } libNMEA_gps_valid_t;
tosihisa 0:6089ae824f06 94
tosihisa 0:6089ae824f06 95 typedef struct {
tosihisa 0:6089ae824f06 96 libNMEA_gps_valid_t valid;
tosihisa 0:6089ae824f06 97 libNMEA_gps_status_t status;
tosihisa 0:6089ae824f06 98 libNMEA_gps_date_t date;
tosihisa 0:6089ae824f06 99 libNMEA_gps_time_t time;
tosihisa 0:6089ae824f06 100 libNMEA_gps_latlon_t latlon;
tosihisa 0:6089ae824f06 101 libNMEA_gps_speed_t speed;
tosihisa 0:6089ae824f06 102 libNMEA_gps_direction_t direction;
tosihisa 0:6089ae824f06 103 libNMEA_gps_accuracy_t accuracy;
tosihisa 0:6089ae824f06 104 } libNMEA_gps_info_t;
tosihisa 0:6089ae824f06 105
tosihisa 0:6089ae824f06 106 typedef struct {
tosihisa 0:6089ae824f06 107 short cjobst;
tosihisa 0:6089ae824f06 108 unsigned char raw[82+2];
tosihisa 0:6089ae824f06 109 short rawLength;
tosihisa 0:6089ae824f06 110 unsigned char sum;
tosihisa 0:6089ae824f06 111 unsigned char sumwk;
tosihisa 0:6089ae824f06 112 short argc;
tosihisa 0:6089ae824f06 113 short argv[31]; /* NMEA センテンスで処理できる最大トークン数.メモリを節約したいのでポインタではなく先頭からのオフセットにしている. */
tosihisa 0:6089ae824f06 114 } libNMEA_data_t;
tosihisa 0:6089ae824f06 115
tosihisa 0:6089ae824f06 116 extern short libNMEA_Parse1Char(unsigned char c,libNMEA_data_t *buffer);
tosihisa 0:6089ae824f06 117 short libNMEA_Parse1Line(libNMEA_data_t *buffer,libNMEA_gps_info_t *GPSinfo);
tosihisa 0:6089ae824f06 118
tosihisa 0:6089ae824f06 119 #ifdef __cplusplus
tosihisa 0:6089ae824f06 120 }
tosihisa 0:6089ae824f06 121 #endif
tosihisa 0:6089ae824f06 122
tosihisa 0:6089ae824f06 123 #endif /* _NMEA_PARSE_H */