CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_GPS/GPS_detect_state.h
Views: 1798
1
/*
2
This program is free software: you can redistribute it and/or modify
3
it under the terms of the GNU General Public License as published by
4
the Free Software Foundation, either version 3 of the License, or
5
(at your option) any later version.
6
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
11
12
You should have received a copy of the GNU General Public License
13
along with this program. If not, see <http://www.gnu.org/licenses/>.
14
*/
15
16
/*
17
GPS detection state structures. These need to be in a separate
18
header to prevent a circular dependency between AP_GPS and the
19
backend drivers.
20
21
These structures are allocated as a single block in AP_GPS during
22
driver detection, then freed once the detection is finished. Each
23
GPS driver needs to implement a static _detect() function which uses
24
this state information to detect if the attached GPS is of the
25
specific type that it handles.
26
*/
27
28
#include "AP_GPS_config.h"
29
30
#if AP_GPS_NMEA_ENABLED
31
struct NMEA_detect_state {
32
uint8_t step;
33
uint8_t ck;
34
};
35
#endif
36
37
#if AP_GPS_SIRF_ENABLED
38
struct SIRF_detect_state {
39
uint16_t checksum;
40
uint8_t step, payload_length, payload_counter;
41
};
42
#endif
43
44
#if AP_GPS_UBLOX_ENABLED
45
struct UBLOX_detect_state {
46
uint8_t payload_length, payload_counter;
47
uint8_t step;
48
uint8_t ck_a, ck_b;
49
};
50
#endif
51
52
#if AP_GPS_ERB_ENABLED
53
struct ERB_detect_state {
54
uint8_t payload_length, payload_counter;
55
uint8_t step;
56
uint8_t ck_a, ck_b;
57
};
58
#endif
59
60
#if AP_GPS_SBP_ENABLED
61
struct SBP_detect_state {
62
enum {
63
WAITING = 0,
64
GET_TYPE = 1,
65
GET_SENDER = 2,
66
GET_LEN = 3,
67
GET_MSG = 4,
68
GET_CRC = 5
69
} state:8;
70
uint16_t msg_type;
71
uint8_t n_read;
72
uint8_t msg_len;
73
uint16_t crc_so_far;
74
uint16_t crc;
75
uint8_t heartbeat_buff[4];
76
};
77
#endif
78
79
#if AP_GPS_SBP2_ENABLED
80
struct SBP2_detect_state {
81
enum {
82
WAITING = 0,
83
GET_TYPE = 1,
84
GET_SENDER = 2,
85
GET_LEN = 3,
86
GET_MSG = 4,
87
GET_CRC = 5
88
} state:8;
89
uint16_t msg_type;
90
uint8_t n_read;
91
uint8_t msg_len;
92
uint16_t crc_so_far;
93
uint16_t crc;
94
uint8_t heartbeat_buff[4];
95
};
96
#endif
97
98