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/>.
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 2000 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)
35 GPS_INITIALIZING
, // 1
37 GPS_LOST_COMMUNICATION
, // 3
41 const gpsConfig_t
* gpsConfig
;
42 const serialConfig_t
* serialConfig
;
43 serialPort_t
* gpsPort
; // Serial GPS only
48 gpsBaudRate_e baudrateIndex
;
49 gpsBaudRate_e autoBaudrateIndex
; // Driver internal use (for autoBaud)
50 uint8_t autoConfigStep
; // Driver internal use (for autoConfig)
52 timeMs_t lastStateSwitchMs
;
53 timeMs_t lastLastMessageMs
;
54 timeMs_t lastMessageMs
;
58 extern gpsReceiverData_t gpsState
;
60 extern baudRate_e gpsToSerialBaudRate
[GPS_BAUDRATE_COUNT
];
62 extern void gpsSetState(gpsState_e state
);
63 extern void gpsFinalizeChangeBaud(void);
65 extern uint16_t gpsConstrainEPE(uint32_t epe
);
66 extern uint16_t gpsConstrainHDOP(uint32_t hdop
);
68 void gpsProcessNewSolutionData(void);
69 void gpsSetProtocolTimeout(timeMs_t timeoutMs
);
71 extern void gpsRestartUBLOX(void);
72 extern void gpsHandleUBLOX(void);
74 extern void gpsRestartNMEA_MTK(void);
75 extern void gpsHandleNMEA(void);
76 extern void gpsHandleMTK(void);
78 extern void gpsRestartNAZA(void);
79 extern void gpsHandleNAZA(void);
81 extern void gpsRestartMSP(void);
82 extern void gpsHandleMSP(void);