annotate Small_CPU/Src/GNSS.c @ 931:5a9bc2e6112d Evo_2_23 tip

Added Sat Status Overview: In addition to the navigation data now information regarding the satelliete and signal status are visualized. To enable the a new command has been added to the communication protocol and the position view has been extended.
author Ideenmodellierer
date Tue, 03 Dec 2024 20:32:51 +0100
parents c0553dd70608
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
887
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
1 /*
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
2 * GNSS.c
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
3 *
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
4 * Created on: 03.10.2020
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
5 * Author: SimpleMethod
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
6 *
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
7 *Copyright 2020 SimpleMethod
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
8 *
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
9 *Permission is hereby granted, free of charge, to any person obtaining a copy of
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
10 *this software and associated documentation files (the "Software"), to deal in
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
11 *the Software without restriction, including without limitation the rights to
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
12 *use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
13 *of the Software, and to permit persons to whom the Software is furnished to do
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
14 *so, subject to the following conditions:
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
15 *
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
16 *The above copyright notice and this permission notice shall be included in all
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
17 *copies or substantial portions of the Software.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
18 *
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
19 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
20 *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
21 *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
22 *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
23 *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
24 *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
25 *THE SOFTWARE.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
26 ******************************************************************************
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
27 */
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
28
931
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
29 #include <string.h>
887
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
30 #include "GNSS.h"
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
31
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
32 union u_Short uShort;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
33 union i_Short iShort;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
34 union u_Long uLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
35 union i_Long iLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
36
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
37 /*!
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
38 * Structure initialization.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
39 * @param GNSS Pointer to main GNSS structure.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
40 * @param huart Pointer to uart handle.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
41 */
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
42 void GNSS_Init(GNSS_StateHandle *GNSS, UART_HandleTypeDef *huart) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
43 GNSS->huart = huart;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
44 GNSS->year = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
45 GNSS->month = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
46 GNSS->day = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
47 GNSS->hour = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
48 GNSS->min = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
49 GNSS->sec = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
50 GNSS->fixType = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
51 GNSS->lon = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
52 GNSS->lat = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
53 GNSS->height = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
54 GNSS->hMSL = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
55 GNSS->hAcc = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
56 GNSS->vAcc = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
57 GNSS->gSpeed = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
58 GNSS->headMot = 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
59 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
60
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
61 /*!
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
62 * Searching for a header in data buffer and matching class and message ID to buffer data.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
63 * @param GNSS Pointer to main GNSS structure.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
64 */
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents: 887
diff changeset
65 uint8_t GNSS_ParseBuffer(GNSS_StateHandle *GNSS) {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents: 887
diff changeset
66
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents: 887
diff changeset
67 uint8_t DataReceived = 0;
887
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
68
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
69 for (int var = 0; var <= 100; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
70 if (GNSS->uartWorkingBuffer[var] == 0xB5
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
71 && GNSS->uartWorkingBuffer[var + 1] == 0x62) {
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents: 887
diff changeset
72 DataReceived = 1;
887
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
73 if (GNSS->uartWorkingBuffer[var + 2] == 0x27
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
74 && GNSS->uartWorkingBuffer[var + 3] == 0x03) { //Look at: 32.19.1.1 u-blox 8 Receiver description
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
75 GNSS_ParseUniqID(GNSS);
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
76 } else if (GNSS->uartWorkingBuffer[var + 2] == 0x01
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
77 && GNSS->uartWorkingBuffer[var + 3] == 0x21) { //Look at: 32.17.14.1 u-blox 8 Receiver description
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
78 GNSS_ParseNavigatorData(GNSS);
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
79 } else if (GNSS->uartWorkingBuffer[var + 2] == 0x01
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
80 && GNSS->uartWorkingBuffer[var + 3] == 0x07) { //ook at: 32.17.30.1 u-blox 8 Receiver description
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
81 GNSS_ParsePVTData(GNSS);
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
82 } else if (GNSS->uartWorkingBuffer[var + 2] == 0x01
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
83 && GNSS->uartWorkingBuffer[var + 3] == 0x02) { // Look at: 32.17.15.1 u-blox 8 Receiver description
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
84 GNSS_ParsePOSLLHData(GNSS);
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
85 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
86 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
87 }
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents: 887
diff changeset
88 return DataReceived;
887
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
89 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
90
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
91 /*!
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
92 * Make request for unique chip ID data.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
93 * @param GNSS Pointer to main GNSS structure.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
94 */
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
95 void GNSS_GetUniqID(GNSS_StateHandle *GNSS) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
96 HAL_UART_Transmit_DMA(GNSS->huart, getDeviceID,
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
97 sizeof(getDeviceID) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
98 HAL_UART_Receive_IT(GNSS->huart, GNSS_Handle.uartWorkingBuffer, 17);
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
99 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
100
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
101 /*!
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
102 * Make request for UTC time solution data.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
103 * @param GNSS Pointer to main GNSS structure.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
104 */
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
105 void GNSS_GetNavigatorData(GNSS_StateHandle *GNSS) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
106 HAL_UART_Transmit_DMA(GNSS->huart, getNavigatorData,
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
107 sizeof(getNavigatorData) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
108 HAL_UART_Receive_IT(GNSS->huart, GNSS_Handle.uartWorkingBuffer, 28);
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
109 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
110
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
111 /*!
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
112 * Make request for geodetic position solution data.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
113 * @param GNSS Pointer to main GNSS structure.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
114 */
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
115 void GNSS_GetPOSLLHData(GNSS_StateHandle *GNSS) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
116 HAL_UART_Transmit_DMA(GNSS->huart, getPOSLLHData,
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
117 sizeof(getPOSLLHData) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
118 HAL_UART_Receive_IT(GNSS->huart, GNSS_Handle.uartWorkingBuffer, 36);
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
119 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
120
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
121 /*!
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
122 * Make request for navigation position velocity time solution data.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
123 * @param GNSS Pointer to main GNSS structure.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
124 */
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
125 void GNSS_GetPVTData(GNSS_StateHandle *GNSS) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
126 HAL_UART_Transmit_DMA(GNSS->huart, getPVTData,
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
127 sizeof(getPVTData) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
128 HAL_UART_Receive_IT(GNSS->huart, GNSS_Handle.uartWorkingBuffer, 100);
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
129 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
130
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
131 /*!
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
132 * Parse data to unique chip ID standard.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
133 * Look at: 32.19.1.1 u-blox 8 Receiver description
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
134 * @param GNSS Pointer to main GNSS structure.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
135 */
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
136 void GNSS_ParseUniqID(GNSS_StateHandle *GNSS) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
137 for (int var = 0; var < 5; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
138 GNSS->uniqueID[var] = GNSS_Handle.uartWorkingBuffer[10 + var];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
139 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
140 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
141
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
142 /*!
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
143 * Changing the GNSS mode.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
144 * Look at: 32.10.19 u-blox 8 Receiver description
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
145 */
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
146 void GNSS_SetMode(GNSS_StateHandle *GNSS, short gnssMode) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
147 if (gnssMode == 0) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
148 HAL_UART_Transmit_DMA(GNSS->huart, setPortableMode,sizeof(setPortableMode) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
149 } else if (gnssMode == 1) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
150 HAL_UART_Transmit_DMA(GNSS->huart, setStationaryMode,sizeof(setStationaryMode) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
151 } else if (gnssMode == 2) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
152 HAL_UART_Transmit_DMA(GNSS->huart, setPedestrianMode,sizeof(setPedestrianMode) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
153 } else if (gnssMode == 3) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
154 HAL_UART_Transmit_DMA(GNSS->huart, setAutomotiveMode,sizeof(setAutomotiveMode) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
155 } else if (gnssMode == 4) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
156 HAL_UART_Transmit_DMA(GNSS->huart, setAutomotiveMode,sizeof(setAutomotiveMode) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
157 } else if (gnssMode == 5) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
158 HAL_UART_Transmit_DMA(GNSS->huart, setAirbone1GMode,sizeof(setAirbone1GMode) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
159 } else if (gnssMode == 6) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
160 HAL_UART_Transmit_DMA(GNSS->huart, setAirbone2GMode,sizeof(setAirbone2GMode) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
161 } else if (gnssMode == 7) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
162 HAL_UART_Transmit_DMA(GNSS->huart, setAirbone4GMode,sizeof(setAirbone4GMode) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
163 } else if (gnssMode == 8) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
164 HAL_UART_Transmit_DMA(GNSS->huart, setWirstMode,sizeof(setWirstMode) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
165 } else if (gnssMode == 9) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
166 HAL_UART_Transmit_DMA(GNSS->huart, setBikeMode,sizeof(setBikeMode) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
167 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
168 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
169 /*!
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
170 * Parse data to navigation position velocity time solution standard.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
171 * Look at: 32.17.15.1 u-blox 8 Receiver description.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
172 * @param GNSS Pointer to main GNSS structure.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
173 */
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
174 void GNSS_ParsePVTData(GNSS_StateHandle *GNSS) {
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
175
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
176 static float searchCnt = 1.0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
177
887
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
178 uShort.bytes[0] = GNSS_Handle.uartWorkingBuffer[10];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
179 GNSS->yearBytes[0]=GNSS_Handle.uartWorkingBuffer[10];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
180 uShort.bytes[1] = GNSS_Handle.uartWorkingBuffer[11];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
181 GNSS->yearBytes[1]=GNSS_Handle.uartWorkingBuffer[11];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
182 GNSS->year = uShort.uShort;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
183 GNSS->month = GNSS_Handle.uartWorkingBuffer[12];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
184 GNSS->day = GNSS_Handle.uartWorkingBuffer[13];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
185 GNSS->hour = GNSS_Handle.uartWorkingBuffer[14];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
186 GNSS->min = GNSS_Handle.uartWorkingBuffer[15];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
187 GNSS->sec = GNSS_Handle.uartWorkingBuffer[16];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
188 GNSS->fixType = GNSS_Handle.uartWorkingBuffer[26];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
189
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
190 for (int var = 0; var < 4; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
191 iLong.bytes[var] = GNSS_Handle.uartWorkingBuffer[var + 30];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
192 GNSS->lonBytes[var]= GNSS_Handle.uartWorkingBuffer[var + 30];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
193 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
194 GNSS->lon = iLong.iLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
195 GNSS->fLon=(float)iLong.iLong/10000000.0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
196 for (int var = 0; var < 4; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
197 iLong.bytes[var] = GNSS_Handle.uartWorkingBuffer[var + 34];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
198 GNSS->latBytes[var]=GNSS_Handle.uartWorkingBuffer[var + 34];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
199 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
200 GNSS->lat = iLong.iLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
201 GNSS->fLat=(float)iLong.iLong/10000000.0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
202 for (int var = 0; var < 4; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
203 iLong.bytes[var] = GNSS_Handle.uartWorkingBuffer[var + 38];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
204 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
205 GNSS->height = iLong.iLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
206
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
207 for (int var = 0; var < 4; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
208 iLong.bytes[var] = GNSS_Handle.uartWorkingBuffer[var + 42];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
209 GNSS->hMSLBytes[var] = GNSS_Handle.uartWorkingBuffer[var + 42];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
210 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
211 GNSS->hMSL = iLong.iLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
212
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
213 for (int var = 0; var < 4; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
214 uLong.bytes[var] = GNSS_Handle.uartWorkingBuffer[var + 46];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
215 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
216 GNSS->hAcc = uLong.uLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
217
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
218 for (int var = 0; var < 4; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
219 uLong.bytes[var] = GNSS_Handle.uartWorkingBuffer[var + 50];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
220 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
221 GNSS->vAcc = uLong.uLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
222
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
223 for (int var = 0; var < 4; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
224 iLong.bytes[var] = GNSS_Handle.uartWorkingBuffer[var + 66];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
225 GNSS->gSpeedBytes[var] = GNSS_Handle.uartWorkingBuffer[var + 66];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
226 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
227 GNSS->gSpeed = iLong.iLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
228
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
229 for (int var = 0; var < 4; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
230 iLong.bytes[var] = GNSS_Handle.uartWorkingBuffer[var + 70];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
231 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
232 GNSS->headMot = iLong.iLong * 1e-5; // todo I'm not sure this good options.
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
233
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
234 if((GNSS->fLat == 0.0) && (GNSS->fLon == 0.0))
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
235 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
236 GNSS->fLat = searchCnt++;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
237 }
887
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
238 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
239
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
240 /*!
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
241 * Parse data to UTC time solution standard.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
242 * Look at: 32.17.30.1 u-blox 8 Receiver description.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
243 * @param GNSS Pointer to main GNSS structure.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
244 */
931
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
245 void GNSS_ParseNavSatData(GNSS_StateHandle *GNSS) {
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
246
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
247 uint8_t loop = 0;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
248 uint8_t searchIndex = 0;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
249 uint8_t statIndex = 0; /* only 4 state information will be forwarded */
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
250 uint8_t signalQuality = 0;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
251 GNSS->numSat = GNSS_Handle.uartWorkingBuffer[11];
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
252
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
253 memset(GNSS->statSat, 0, sizeof(GNSS->statSat));
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
254
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
255 if(GNSS->numSat > 0)
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
256 {
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
257 searchIndex = 0;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
258 while((searchIndex < GNSS->numSat) && (statIndex < 4)) /* get good signal quality */
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
259 {
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
260 signalQuality = (GNSS_Handle.uartWorkingBuffer[22 + searchIndex * 12] & 0x7);
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
261 if(signalQuality > 4)
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
262 {
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
263 GNSS->statSat[statIndex++] = signalQuality;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
264 }
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
265 if(statIndex == 4) break;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
266 searchIndex++;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
267 }
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
268 searchIndex = 0;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
269 while((searchIndex < GNSS->numSat) && (statIndex < 4)) /* get medium signal quality */
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
270 {
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
271 signalQuality = (GNSS_Handle.uartWorkingBuffer[22 + searchIndex * 12] & 0x7);
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
272 if((signalQuality > 2) && (signalQuality <= 4))
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
273 {
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
274 GNSS->statSat[statIndex++] = signalQuality;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
275 }
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
276 if(statIndex == 4) break;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
277 searchIndex++;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
278 }
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
279 searchIndex = 0;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
280 while((searchIndex < GNSS->numSat) && (statIndex < 4)) /* get poor signal quality */
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
281 {
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
282 signalQuality = (GNSS_Handle.uartWorkingBuffer[22 + searchIndex * 12] & 0x7);
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
283 if(signalQuality <= 2)
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
284 {
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
285 GNSS->statSat[statIndex++] = signalQuality;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
286 }
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
287 if(statIndex == 4) break;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
288 searchIndex++;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
289 }
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
290 loop++;
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
291 }
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
292 }
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
293
887
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
294 void GNSS_ParseNavigatorData(GNSS_StateHandle *GNSS) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
295 uShort.bytes[0] = GNSS_Handle.uartWorkingBuffer[18];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
296 uShort.bytes[1] = GNSS_Handle.uartWorkingBuffer[19];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
297 GNSS->year = uShort.uShort;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
298 GNSS->month = GNSS_Handle.uartWorkingBuffer[20];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
299 GNSS->day = GNSS_Handle.uartWorkingBuffer[21];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
300 GNSS->hour = GNSS_Handle.uartWorkingBuffer[22];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
301 GNSS->min = GNSS_Handle.uartWorkingBuffer[23];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
302 GNSS->sec = GNSS_Handle.uartWorkingBuffer[24];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
303 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
304
931
5a9bc2e6112d Added Sat Status Overview:
Ideenmodellierer
parents: 919
diff changeset
305
887
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
306 /*!
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
307 * Parse data to geodetic position solution standard.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
308 * Look at: 32.17.14.1 u-blox 8 Receiver description.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
309 * @param GNSS Pointer to main GNSS structure.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
310 */
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
311 void GNSS_ParsePOSLLHData(GNSS_StateHandle *GNSS) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
312 for (int var = 0; var < 4; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
313 iLong.bytes[var] = GNSS_Handle.uartWorkingBuffer[var + 10];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
314 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
315 GNSS->lon = iLong.iLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
316 GNSS->fLon=(float)iLong.iLong/10000000.0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
317
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
318 for (int var = 0; var < 4; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
319 iLong.bytes[var] = GNSS_Handle.uartWorkingBuffer[var + 14];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
320 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
321 GNSS->lat = iLong.iLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
322 GNSS->fLat=(float)iLong.iLong/10000000.0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
323
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
324 for (int var = 0; var < 4; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
325 iLong.bytes[var] = GNSS_Handle.uartWorkingBuffer[var + 18];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
326 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
327 GNSS->height = iLong.iLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
328
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
329 for (int var = 0; var < 4; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
330 iLong.bytes[var] = GNSS_Handle.uartWorkingBuffer[var + 22];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
331 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
332 GNSS->hMSL = iLong.iLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
333
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
334 for (int var = 0; var < 4; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
335 uLong.bytes[var] = GNSS_Handle.uartWorkingBuffer[var + 26];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
336 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
337 GNSS->hAcc = uLong.uLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
338
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
339 for (int var = 0; var < 4; ++var) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
340 uLong.bytes[var] = GNSS_Handle.uartWorkingBuffer[var + 30];
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
341 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
342 GNSS->vAcc = uLong.uLong;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
343 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
344
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
345 /*!
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
346 * Sends the basic configuration: Activation of the UBX standard, change of NMEA version to 4.10 and turn on of the Galileo system.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
347 * @param GNSS Pointer to main GNSS structure.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
348 */
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
349 void GNSS_LoadConfig(GNSS_StateHandle *GNSS) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
350 HAL_UART_Transmit_DMA(GNSS->huart, configUBX,
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
351 sizeof(configUBX) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
352 HAL_Delay(250);
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
353 HAL_UART_Transmit_DMA(GNSS->huart, setNMEA410,
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
354 sizeof(setNMEA410) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
355 HAL_Delay(250);
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
356 HAL_UART_Transmit_DMA(GNSS->huart, setGNSS,
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
357 sizeof(setGNSS) / sizeof(uint8_t));
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
358 HAL_Delay(250);
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
359 }
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
360
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
361
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
362
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
363 /*!
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
364 * Creates a checksum based on UBX standard.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
365 * @param class Class value from UBX doc.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
366 * @param messageID MessageID value from UBX doc.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
367 * @param dataLength Data length value from UBX doc.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
368 * @param payload Just payload.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
369 * @return Returns checksum.
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
370 */
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
371 uint8_t GNSS_Checksum(uint8_t class, uint8_t messageID, uint8_t dataLength,uint8_t *payload) {
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
372 //todo: Look at 32.4 UBX Checksum
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
373 return 0;
17f02ac9da67 adding GNSS code
heinrichsweikamp
parents:
diff changeset
374 }