SENSORS: Gyro/accel aligmnet fix
[betaflight.git] / src / main / io / gps_private.h
blobf6b7a7d9d27acc6c49eb637d4a2cb18433ea07c7
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #ifdef GPS
22 #define GPS_HDOP_TO_EPH_MULTIPLIER 2 // empirical value
24 typedef enum {
25 GPS_UNKNOWN, // 0
26 GPS_INITIALIZING, // 1
27 GPS_CHANGE_BAUD, // 2
28 GPS_CHECK_VERSION, // 3
29 GPS_CONFIGURE, // 4
30 GPS_RECEIVING_DATA, // 5
31 GPS_LOST_COMMUNICATION, // 6
32 } gpsState_e;
34 typedef struct {
35 gpsConfig_t * gpsConfig;
36 serialConfig_t * serialConfig;
37 serialPort_t * gpsPort; // Serial GPS only
39 uint32_t hwVersion;
41 gpsState_e state;
42 gpsBaudRate_e baudrateIndex;
43 gpsBaudRate_e autoBaudrateIndex; // Driver internal use (for autoBaud)
44 uint8_t autoConfigStep; // Driver internal use (for autoConfig)
45 uint8_t autoConfigPosition; // Driver internal use (for autoConfig)
47 uint32_t lastStateSwitchMs;
48 uint32_t lastLastMessageMs;
49 uint32_t lastMessageMs;
50 } gpsReceiverData_t;
52 extern gpsReceiverData_t gpsState;
54 extern baudRate_e gpsToSerialBaudRate[GPS_BAUDRATE_COUNT];
56 extern void gpsSetState(gpsState_e state);
57 extern void gpsFinalizeChangeBaud(void);
59 extern uint16_t gpsConstrainEPE(uint32_t epe);
60 extern uint16_t gpsConstrainHDOP(uint32_t hdop);
62 extern bool gpsHandleNMEA(void);
63 extern bool gpsHandleUBLOX(void);
64 extern bool gpsHandleI2CNAV(void);
65 extern bool gpsDetectI2CNAV(void);
66 extern bool gpsHandleNAZA(void);
68 #endif