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/>.
20 #define GPS_DBHZ_MIN 0
21 #define GPS_DBHZ_MAX 55
23 #define GPS_SV_MAXSATS 16
28 #define GPS_DEGREES_DIVIDER 10000000L
46 #define SBAS_MODE_MAX SBAS_GAGAN
49 GPS_BAUDRATE_115200
= 0,
58 GPS_AUTOCONFIG_OFF
= 0,
72 #define GPS_BAUDRATE_MAX GPS_BAUDRATE_9600
74 typedef struct gpsConfig_s
{
75 gpsProvider_e provider
;
77 gpsAutoConfig_e autoConfig
;
78 gpsAutoBaud_e autoBaud
;
79 gpsNavModel_e navModel
;
82 typedef struct gpsCoordinateDDDMMmmmm_s
{
85 } gpsCoordinateDDDMMmmmm_t
;
88 uint8_t chn
; // Channel number
89 uint8_t svid
; // Satellite ID
90 uint8_t quality
; // Bitfield Qualtity
91 uint8_t cno
; // Carrier to Noise Ratio (Signal Strength)
94 /* LLH Location in NEU axis system */
95 typedef struct gpsLocation_s
{
96 int32_t lat
; // Lattitude * 1e+7
97 int32_t lon
; // Longitude * 1e+7
98 int32_t alt
; // Altitude in centimeters (meters * 100)
101 typedef struct gpsSolutionData_s
{
103 unsigned gpsHeartbeat
: 1; // Toggle each update
104 unsigned fix3D
: 1; // gps fix status
105 unsigned validVelNE
: 1;
106 unsigned validVelD
: 1;
107 unsigned validMag
: 1;
108 unsigned validEPE
: 1; // EPH/EPV values are valid - actual accuracy
114 gpsSVChannel_t svInfo
[GPS_SV_MAXSATS
];
121 int16_t groundCourse
;
123 uint16_t eph
; // horizontal accuracy (cm)
124 uint16_t epv
; // vertical accuracy (cm)
128 uint16_t lastMessageDt
;
129 uint32_t errors
; // gps error counter - crc error/lost of data/sync etc..
131 uint32_t packetCount
;
134 extern gpsSolutionData_t gpsSol
;
135 extern gpsStatistics_t gpsStats
;
137 void gpsThread(void);
138 void updateGpsIndicator(uint32_t currentTime
);