annotate Small_CPU/Src/uartProtocol_GNSS.c @ 928:9b7859554beb Evo_2_23 tip

Cleanup Internal Uart: The compile switches have been updated to allow GNSS data flow if new GPIO config is available or if GNSS is enabled for the external UART.
author Ideenmodellierer
date Tue, 26 Nov 2024 21:30:06 +0100
parents 7c996354b8ac
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
1 /**
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
2 ******************************************************************************
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
3 * @file uartProtocol_GNSS.c
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
4 * @author heinrichs weikamp gmbh
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
5 * @version V0.0.1
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
6 * @date 30-Sep-2024
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
7 * @brief Interface functionality operation of GNSS devices
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
8 *
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
9 @verbatim
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
10
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
11
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
12 @endverbatim
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
13 ******************************************************************************
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
14 * @attention
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
15 *
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
16 * <h2><center>&copy; COPYRIGHT(c) 2024 heinrichs weikamp</center></h2>
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
17 *
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
18 ******************************************************************************
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
19 */
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
20 /* Includes ------------------------------------------------------------------*/
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
21
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
22 #include <string.h>
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
23 #include "scheduler.h"
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
24 #include <uartProtocol_GNSS.h>
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
25 #include "uart.h"
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
26 #include "GNSS.h"
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
27 #include "configuration.h"
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
28 #include "externalInterface.h"
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
29
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
30 #if defined ENABLE_GNSS || defined ENABLE_GNSS_SUPPORT
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
31
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
32 static receiveStateGnss_t rxState = GNSSRX_READY;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
33 static uint8_t GnssConnected = 0; /* Binary indicator if a sensor is connected or not */
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
34
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
35 static uint8_t writeIndex = 0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
36
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
37 static uint8_t dataToRead = 0;
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
38
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
39 void ConvertByteToHexString(uint8_t byte, char* str)
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
40 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
41 uint8_t worker = 0;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
42 uint8_t digit = 0;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
43 uint8_t digitCnt = 1;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
44
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
45 worker = byte;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
46 while((worker!=0) && (digitCnt != 255))
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
47 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
48 digit = worker % 16;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
49 if( digit < 10)
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
50 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
51 digit += '0';
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
52 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
53 else
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
54 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
55 digit += 'A' - 10;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
56 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
57 str[digitCnt--]= digit;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
58 worker = worker / 16;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
59 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
60 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
61
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
62
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
63 void uartGnss_SendCmd(uint8_t GnssCmd)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
64 {
922
7c996354b8ac Moved UART6 into a separate unit:
Ideenmodellierer
parents: 919
diff changeset
65 const uint8_t* pData;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
66 uint8_t txLength = 0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
67
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
68 switch (GnssCmd)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
69 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
70 case GNSSCMD_LOADCONF_0: pData = configUBX;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
71 txLength = sizeof(configUBX) / sizeof(uint8_t);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
72 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
73 case GNSSCMD_LOADCONF_1: pData = setNMEA410;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
74 txLength = sizeof(setNMEA410) / sizeof(uint8_t);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
75 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
76 case GNSSCMD_LOADCONF_2: pData = setGNSS;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
77 txLength = sizeof(setGNSS) / sizeof(uint8_t);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
78 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
79 case GNSSCMD_GET_PVT_DATA: pData = getPVTData;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
80 txLength = sizeof(getPVTData) / sizeof(uint8_t);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
81 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
82 case GNSSCMD_GET_NAV_DATA: pData = getNavigatorData;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
83 txLength = sizeof(getNavigatorData) / sizeof(uint8_t);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
84 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
85
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
86 default:
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
87 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
88 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
89 if(txLength != 0)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
90 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
91 UART_SendCmdUbx(pData, txLength);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
92 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
93 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
94
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
95 void uartGnss_Control(void)
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
96 {
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
97 static uint32_t warmupTick = 0;
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
98
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
99 uint8_t activeSensor = externalInterface_GetActiveUartSensor();
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
100 uartGnssStatus_t localComState = externalInterface_GetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET);
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
101
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
102 switch (localComState)
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
103 {
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
104 case UART_GNSS_INIT: localComState = UART_GNSS_WARMUP;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
105 warmupTick = HAL_GetTick();
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
106 UART_clearRxBuffer();
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
107 break;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
108 case UART_GNSS_WARMUP: if(time_elapsed_ms(warmupTick,HAL_GetTick()) > 1000)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
109 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
110 localComState = UART_GNSS_LOADCONF_0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
111 }
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
112 break;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
113 case UART_GNSS_LOADCONF_0: uartGnss_SendCmd(GNSSCMD_LOADCONF_0);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
114 localComState = UART_GNSS_LOADCONF_1;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
115 rxState = GNSSRX_DETECT_ACK_0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
116 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
117 case UART_GNSS_LOADCONF_1: uartGnss_SendCmd(GNSSCMD_LOADCONF_1);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
118 localComState = UART_GNSS_LOADCONF_2;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
119 rxState = GNSSRX_DETECT_ACK_0;
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
120 break;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
121 case UART_GNSS_LOADCONF_2: uartGnss_SendCmd(GNSSCMD_LOADCONF_2);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
122 localComState = UART_GNSS_IDLE;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
123 rxState = GNSSRX_DETECT_ACK_0;
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
124 break;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
125 case UART_GNSS_IDLE: uartGnss_SendCmd(GNSSCMD_GET_PVT_DATA);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
126 localComState = UART_GNSS_GET_PVT;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
127 rxState = GNSSRX_DETECT_HEADER_0;
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
128 break;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
129 default:
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
130 break;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
131 }
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
132
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
133 externalInterface_SetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET,localComState);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
134
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
135 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
136
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
137 void uartGnss_ProcessData(uint8_t data)
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
138 {
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
139 uint8_t activeSensor = externalInterface_GetActiveUartSensor();
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
140 GNSS_Handle.uartWorkingBuffer[writeIndex++] = data;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
141 switch(rxState)
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
142 {
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
143 case GNSSRX_DETECT_ACK_0:
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
144 case GNSSRX_DETECT_HEADER_0: if(data == 0xB5)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
145 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
146 writeIndex = 0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
147 memset(GNSS_Handle.uartWorkingBuffer,0, sizeof(GNSS_Handle.uartWorkingBuffer));
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
148 GNSS_Handle.uartWorkingBuffer[writeIndex++] = data;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
149 rxState++;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
150 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
151 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
152 case GNSSRX_DETECT_ACK_1:
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
153 case GNSSRX_DETECT_HEADER_1: if(data == 0x62)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
154 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
155 rxState++;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
156 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
157 else
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
158 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
159 rxState = GNSSRX_DETECT_HEADER_0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
160 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
161 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
162 case GNSSRX_DETECT_ACK_2: if(data == 0x05)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
163 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
164 rxState++;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
165 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
166 else
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
167 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
168 rxState = GNSSRX_DETECT_HEADER_0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
169 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
170 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
171 case GNSSRX_DETECT_ACK_3: if((data == 0x01) || (data == 0x00))
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
172 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
173 GnssConnected = 1;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
174 rxState = GNSSRX_READY;
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 else
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
177 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
178 rxState = GNSSRX_DETECT_HEADER_0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
179 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
180 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
181 case GNSSRX_DETECT_HEADER_2: if(data == 0x01)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
182 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
183 rxState++;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
184 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
185 else
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
186 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
187 rxState = GNSSRX_DETECT_HEADER_0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
188 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
189 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
190 case GNSSRX_DETECT_HEADER_3:
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
191 switch(data)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
192 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
193 case 0x21: rxState = GNSSRX_READ_NAV_DATA;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
194 dataToRead = 20;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
195 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
196 case 0x07: rxState = GNSSRX_READ_PVT_DATA;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
197 dataToRead = 92;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
198 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
199 case 0x02: rxState = GNSSRX_READ_POSLLH_DATA;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
200 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
201 default: rxState = GNSSRX_DETECT_HEADER_0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
202 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
203 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
204 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
205 case GNSSRX_READ_NAV_DATA:
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
206 case GNSSRX_READ_PVT_DATA:
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
207 case GNSSRX_READ_POSLLH_DATA: if(dataToRead > 0)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
208 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
209 dataToRead--;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
210 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
211 else
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
212 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
213 switch(rxState)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
214 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
215 case GNSSRX_READ_NAV_DATA: GNSS_ParseNavigatorData(&GNSS_Handle);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
216 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
217 case GNSSRX_READ_PVT_DATA: GNSS_ParsePVTData(&GNSS_Handle);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
218 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
219 case GNSSRX_READ_POSLLH_DATA: GNSS_ParsePOSLLHData(&GNSS_Handle);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
220 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
221 default: rxState = GNSSRX_DETECT_HEADER_0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
222 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
223 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
224 rxState = GNSSRX_DETECT_HEADER_0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
225 externalInterface_SetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET,UART_GNSS_IDLE);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
226 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
227 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
228 default: rxState = GNSSRX_READY;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
229 break;
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
230 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
231 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
232
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
233 uint8_t uartGnss_isSensorConnected()
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
234 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
235 return GnssConnected;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
236 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
237
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
238 #endif
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
239