Fix WS2812 led definition
[inav.git] / src / main / io / gps_private.h
blobfd35d8540f68b9ce6400b6d102e9823c4c8e5ba1
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;
47 gpsState_e state;
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;
55 timeMs_t timeoutMs;
56 timeMs_t baseTimeoutMs;
57 } gpsReceiverData_t;
59 extern gpsReceiverData_t gpsState;
61 extern baudRate_e gpsToSerialBaudRate[GPS_BAUDRATE_COUNT];
63 extern void gpsSetState(gpsState_e state);
64 extern void gpsFinalizeChangeBaud(void);
66 extern uint16_t gpsConstrainEPE(uint32_t epe);
67 extern uint16_t gpsConstrainHDOP(uint32_t hdop);
69 void gpsProcessNewSolutionData(void);
70 void gpsSetProtocolTimeout(timeMs_t timeoutMs);
72 extern void gpsRestartUBLOX(void);
73 extern void gpsHandleUBLOX(void);
75 extern void gpsRestartNMEA(void);
76 extern void gpsHandleNMEA(void);
78 extern void gpsRestartMSP(void);
79 extern void gpsHandleMSP(void);
81 #endif