vtx: fix VTX_SETTINGS_POWER_COUNT and add dummy entries to saPowerNames
[inav.git] / src / main / io / gps_private.h
blobe5234e70248ae177b26aef38b8a97c0d1a5da8e8
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 USE_GPS
22 #include "io/serial.h"
24 #define GPS_HDOP_TO_EPH_MULTIPLIER 2 // empirical value
26 // GPS timeout for wrong baud rate/disconnection/etc in milliseconds (default 1000 ms)
27 #define GPS_TIMEOUT (1000)
28 #define GPS_SHORT_TIMEOUT (500)
29 #define GPS_BAUD_CHANGE_DELAY (100)
30 #define GPS_INIT_DELAY (500)
31 #define GPS_BOOT_DELAY (3000)
33 typedef enum {
34 GPS_UNKNOWN, // 0
35 GPS_INITIALIZING, // 1
36 GPS_RUNNING, // 2
37 GPS_LOST_COMMUNICATION, // 3
38 } gpsState_e;
40 typedef struct {
41 const gpsConfig_t * gpsConfig;
42 const serialConfig_t * serialConfig;
43 serialPort_t * gpsPort; // Serial GPS only
45 uint32_t hwVersion;
46 uint8_t swVersionMajor;
47 uint8_t swVersionMinor;
49 gpsState_e state;
50 gpsBaudRate_e baudrateIndex;
51 gpsBaudRate_e autoBaudrateIndex; // Driver internal use (for autoBaud)
52 uint8_t autoConfigStep; // Driver internal use (for autoConfig)
53 struct
55 uint8_t pvt : 1;
56 uint8_t sig : 1;
57 uint8_t sat : 1;
58 } flags;
60 timeMs_t lastStateSwitchMs;
61 timeMs_t lastLastMessageMs;
62 timeMs_t lastMessageMs;
63 timeMs_t timeoutMs;
64 timeMs_t baseTimeoutMs;
65 timeMs_t lastCapaPoolMs;
66 timeMs_t lastCapaUpdMs;
67 } gpsReceiverData_t;
69 extern gpsReceiverData_t gpsState;
70 extern gpsSolutionData_t gpsSolDRV;
72 extern baudRate_e gpsToSerialBaudRate[GPS_BAUDRATE_COUNT];
74 extern void gpsSetState(gpsState_e state);
75 extern void gpsFinalizeChangeBaud(void);
77 extern uint16_t gpsConstrainEPE(uint32_t epe);
78 extern uint16_t gpsConstrainHDOP(uint32_t hdop);
80 void gpsProcessNewDriverData(void);
81 void gpsProcessNewSolutionData(bool);
82 void gpsSetProtocolTimeout(timeMs_t timeoutMs);
84 extern void gpsRestartUBLOX(void);
85 extern void gpsHandleUBLOX(void);
87 extern void gpsRestartMSP(void);
88 extern void gpsHandleMSP(void);
90 #if defined(USE_GPS_FAKE)
91 extern void gpsFakeRestart(void);
92 extern void gpsFakeHandle(void);
93 #endif
96 #endif