gps.h
Go to the documentation of this file.
1 /*
2  * KubOS Core Flight Services
3  * Copyright (C) 2015 Kubos Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
32 #ifndef GPS_H
33 #define GPS_H
34 
35 #include "kubos-core/k_msg.h"
36 #include "kubos-core/arch/k_uart.h"
37 #include "kubos-core/k_thread.h"
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #ifndef GPS_MSG_Q_SIZE
44 #define GPS_MSG_Q_SIZE 4
45 #endif
46 
47 #ifndef GPS_BUFSIZE
48 #define GPS_BUFSIZE 128
49 #endif
50 
51 #ifndef GPS_DATALOG_SIZE
52 #define GPS_DATALOG_SIZE (1024 * 512)
53 #endif
54 
55 typedef struct gps_cfg {
56  struct uart_conf * uart_conf;
57  csp_conn_t * conn;
58  uint16_t type;
59 } gps_cfg_t;
60 
61 typedef struct {
70  uint8_t hour, minute, seconds, year, month, day;
71 
73  uint16_t milliseconds;
75  float latitude;
77  float longitude;
79  float altitude;
81  float speed;
83  float climb;
84 } gps_fix_t;
85 
86 void gps_connect(gps_cfg_t* config);
87 gps_fix_t *gps_last_fix(void);
88 
89 void gps_rx_cb (void * arg, uint8_t *buf, int len, void *pxTaskWoken);
90 
91 void simple_rx(uint8_t * buf, int len, void * px);
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif // GPS_H
98 
99 /* @} */
float longitude
Longitude in degrees (-180, 180)
Definition: gps.h:77
float climb
Vertical speed, meters/sec.
Definition: gps.h:83
struct uart_conf * uart_conf
Definition: gps.h:56
Usart configuration, to be used with the uart_init call.
Definition: k_uart.h:43
gps_fix_t * gps_last_fix(void)
Definition: gps.h:61
struct gps_cfg gps_cfg_t
uint16_t type
Definition: gps.h:58
float speed
Speed over ground, meters/sec.
Definition: gps.h:81
float altitude
Altitude in meters.
Definition: gps.h:79
uint16_t milliseconds
Millis: 0-999.
Definition: gps.h:73
UART interface.
uint8_t year
Definition: gps.h:70
void gps_connect(gps_cfg_t *config)
Messaging layer.
void gps_rx_cb(void *arg, uint8_t *buf, int len, void *pxTaskWoken)
float latitude
Latitude in degrees (-90, 90)
Definition: gps.h:75
Definition: gps.h:55
csp_conn_t * conn
Definition: gps.h:57
void simple_rx(uint8_t *buf, int len, void *px)