OSDN Git Service

ring.c read pointer no.2 add
[scilog/cpu2010.git] / ublox.h
1 #ifndef __UBLOX_H__
2
3 #define __UBLOX_H__
4
5 #include "myuart.h"
6
7 // UBXパケットID
8 #define UBX_CLS_CFG  0x06
9 #define UBX_CLS_NAV  0x01
10
11 // CFG-
12 #define UBX_ID_CFG_PRT  0x00
13 #define UBX_ID_CFG_TP5  0x31
14 #define UBX_ID_CFG_MSG  0x01
15 // NAV-
16 #define UBX_ID_NAV_TIMEUTC  0x21
17
18 #define UBX_LEN_NAV_TIMEUTC 20
19
20 // NAV-TIMEUTCパケットのデータ格納
21 typedef struct {
22     unsigned long   tow;    // ms GPS Millisecond Time of Week
23     unsigned long   tacc;   // ns Time Accuracy Estimate
24     long   nano;            //ns Nanoseconds of second, range -1e9 .. 1e9 (UTC)
25     unsigned int    year;   // UTC
26     unsigned char   month;
27     unsigned char   day;
28     unsigned char   hour;
29     unsigned char   min;
30     unsigned char   sec;
31     unsigned char   valid;  // Validity Flags
32                             //  bit0 validTOW 1 = Valid Time of Week
33                             //  bit1 validWKN 1 = Valid Week Number
34                             //  bit2 validUTC 1 = Valid UTC (Leap Seconds already known)
35 } UbloxNavTimeUtc;
36
37 int ublox_make_cmd(unsigned char id1, unsigned char id2, unsigned int lenp, unsigned char *payload, unsigned char pkt[]);
38 void ublox_debug_pkt_out(unsigned char *pkt, int len);
39 void ublox_send(unsigned char *pkt, unsigned int len_pkt);
40
41 void ublox_send_cfg_prt(unsigned long bps);
42 void ublox_send_cfg_nmea(void);
43 void ublox_send_cfg_tp5_timepulse2(void);
44 void ublox_send_cfg_msg(void);
45
46 void ublox_send_cfg_tp5_timepulse1(void);
47
48 //void ublox_rcv_poll(void);
49 #define ublox_rcvbuf_clear() uart1_rcvbuf_clear()
50
51 int ublox_rcv_pkt(unsigned char *class, unsigned char *id, unsigned int *len, unsigned char *payload);
52 int ublox_rcv_ack(void);
53
54 #endif