annotate Small_CPU/Src/uartProtocol_GNSS.c @ 942:06aaccaf2e02 Evo_2_23

Power down gnss module during dive: The gnss modul will now be send to powerdown at the start of the dive. After end of dive the module returns to normal operation. For development / test purpose a new simulated dive profile has been added.
author Ideenmodellierer
date Mon, 16 Dec 2024 19:09:00 +0100
parents f41974734268
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
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
30
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
31 #if defined ENABLE_GNSS || defined ENABLE_GNSS_SUPPORT || defined ENABLE_GPIO_V2
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
32
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
33 static uartGnssStatus_t gnssState = UART_GNSS_INIT;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
34 static gnssRequest_s activeRequest = {0,0};
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
35
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
36 static receiveStateGnss_t rxState = GNSSRX_READY;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
37 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
38 static uint8_t writeIndex = 0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
39 static uint8_t dataToRead = 0;
936
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
40 static uint8_t ReqPowerDown = 0;
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
41
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
42 void ConvertByteToHexString(uint8_t byte, char* str)
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
43 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
44 uint8_t worker = 0;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
45 uint8_t digit = 0;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
46 uint8_t digitCnt = 1;
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 worker = byte;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
49 while((worker!=0) && (digitCnt != 255))
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 = worker % 16;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
52 if( digit < 10)
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
53 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
54 digit += '0';
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
55 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
56 else
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
57 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
58 digit += 'A' - 10;
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 str[digitCnt--]= digit;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
61 worker = worker / 16;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
62 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
63 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
64
936
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
65 void uartGnss_ReqPowerDown(uint8_t request)
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
66 {
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
67 if(GnssConnected)
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
68 {
939
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
69 ReqPowerDown = request;
936
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
70 }
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
71 }
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
72
939
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
73 uint8_t uartGnss_isPowerDownRequested()
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
74 {
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
75 return ReqPowerDown;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
76 }
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
77
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
78 uartGnssStatus_t uartGnss_GetState()
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
79 {
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
80 return gnssState;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
81 }
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
82 void uartGnss_SetState(uartGnssStatus_t newState)
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
83 {
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
84 gnssState = newState;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
85 }
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
86
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
87 void UART_Gnss_SendCmd(uint8_t GnssCmd)
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
88 {
922
7c996354b8ac Moved UART6 into a separate unit:
Ideenmodellierer
parents: 919
diff changeset
89 const uint8_t* pData;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
90 uint8_t txLength = 0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
91
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
92 switch (GnssCmd)
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 case GNSSCMD_LOADCONF_0: pData = configUBX;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
95 txLength = sizeof(configUBX) / sizeof(uint8_t);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
96 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
97 case GNSSCMD_LOADCONF_1: pData = setNMEA410;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
98 txLength = sizeof(setNMEA410) / sizeof(uint8_t);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
99 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
100 case GNSSCMD_LOADCONF_2: pData = setGNSS;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
101 txLength = sizeof(setGNSS) / sizeof(uint8_t);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
102 break;
939
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
103 case GNSSCMD_SETMOBILE: pData = setPortableMode;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
104 txLength = sizeof(setPortableMode) / sizeof(uint8_t);
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
105 break;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
106 case GNSSCMD_GET_PVT_DATA: pData = getPVTData;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
107 txLength = sizeof(getPVTData) / sizeof(uint8_t);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
108 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
109 case GNSSCMD_GET_NAV_DATA: pData = getNavigatorData;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
110 txLength = sizeof(getNavigatorData) / sizeof(uint8_t);
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
111 break;
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
112 case GNSSCMD_GET_NAVSAT_DATA: pData = getNavSat;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
113 txLength = sizeof(getNavSat) / sizeof(uint8_t);
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
114 break;
936
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
115 case GNSSCMD_MODE_PWS: pData = setPowerLow;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
116 txLength = sizeof(setPowerLow) / sizeof(uint8_t);
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
117 break;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
118 case GNSSCMD_MODE_NORMAL: pData = setPowerNormal;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
119 txLength = sizeof(setPowerNormal) / sizeof(uint8_t);
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
120 break;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
121 case GNSSCMD_SET_CONFIG: pData = setConfig;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
122 txLength = sizeof(setConfig) / sizeof(uint8_t);
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
123 break;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
124 default:
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
125 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
126 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
127 if(txLength != 0)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
128 {
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
129 activeRequest.class = pData[2];
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
130 activeRequest.id = pData[3];
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
131 UART_SendCmdUbx(pData, txLength);
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 }
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 void uartGnss_Control(void)
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 static uint32_t warmupTick = 0;
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
138 static uint8_t dataToggle = 0;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
139 uint8_t activeSensor = 0;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
140 sUartComCtrl* pUartCtrl = UART_GetGnssCtrl();
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
141
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
142 if(pUartCtrl == &Uart1Ctrl)
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
143 {
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
144 activeSensor = externalInterface_GetActiveUartSensor();
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
145 gnssState = externalInterface_GetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET);
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
146 }
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
147
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
148 switch (gnssState)
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
149 {
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
150 case UART_GNSS_INIT: gnssState = UART_GNSS_WARMUP;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
151 warmupTick = HAL_GetTick();
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
152 UART_clearRxBuffer(pUartCtrl);
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
153 break;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
154 case UART_GNSS_WARMUP: if(time_elapsed_ms(warmupTick,HAL_GetTick()) > 1000)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
155 {
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
156 gnssState = UART_GNSS_LOADCONF_0;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
157 }
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
158 break;
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
159 case UART_GNSS_LOADCONF_0: UART_Gnss_SendCmd(GNSSCMD_LOADCONF_0);
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
160 rxState = GNSSRX_DETECT_ACK_0;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
161 break;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
162 case UART_GNSS_LOADCONF_1: UART_Gnss_SendCmd(GNSSCMD_LOADCONF_1);
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
163 rxState = GNSSRX_DETECT_ACK_0;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
164 break;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
165 case UART_GNSS_LOADCONF_2: UART_Gnss_SendCmd(GNSSCMD_LOADCONF_2);
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
166 rxState = GNSSRX_DETECT_ACK_0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
167 break;
939
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
168 case UART_GNSS_SETMODE_MOBILE: UART_Gnss_SendCmd(GNSSCMD_LOADCONF_2);
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
169 rxState = GNSSRX_DETECT_ACK_0;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
170 break;
936
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
171 case UART_GNSS_PWRDOWN: UART_Gnss_SendCmd(GNSSCMD_MODE_PWS);
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
172 rxState = GNSSRX_DETECT_ACK_0;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
173 break;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
174
939
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
175 case UART_GNSS_PWRUP: UART_Gnss_SendCmd(GNSSCMD_MODE_NORMAL);
936
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
176 rxState = GNSSRX_DETECT_ACK_0;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
177 gnssState = UART_GNSS_PWRUP;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
178 break;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
179 case UART_GNSS_SETCONF: UART_Gnss_SendCmd(GNSSCMD_SET_CONFIG);
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
180 rxState = GNSSRX_DETECT_ACK_0;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
181 break;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
182
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
183 case UART_GNSS_IDLE: if(ReqPowerDown)
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
184 {
936
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
185 UART_Gnss_SendCmd(GNSSCMD_MODE_PWS);
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
186 gnssState = UART_GNSS_PWRDOWN;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
187 rxState = GNSSRX_DETECT_ACK_0;
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
188 }
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
189 else
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
190 {
936
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
191 if(dataToggle)
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
192 {
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
193 UART_Gnss_SendCmd(GNSSCMD_GET_PVT_DATA);
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
194 gnssState = UART_GNSS_GET_PVT;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
195 rxState = GNSSRX_DETECT_HEADER_0;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
196 dataToggle = 0;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
197 }
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
198 else
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
199 {
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
200 UART_Gnss_SendCmd(GNSSCMD_GET_NAVSAT_DATA);
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
201 gnssState = UART_GNSS_GET_SAT;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
202 rxState = GNSSRX_DETECT_HEADER_0;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
203 dataToggle = 1;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
204 }
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
205 }
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
206 break;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
207 default:
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
208 break;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
209 }
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
210 if(pUartCtrl == &Uart1Ctrl)
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
211 {
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
212 externalInterface_SetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET,gnssState);
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
213 }
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
214
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
215 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
216
936
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
217
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
218 void uartGnss_ProcessData(uint8_t data)
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
219 {
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
220 static uint16_t rxLength = 0;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
221 static uint8_t ck_A = 0;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
222 static uint8_t ck_B = 0;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
223 static uint8_t ck_A_Ref = 0;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
224 static uint8_t ck_B_Ref = 0;
936
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
225 uint8_t activeSensor = 0;
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
226
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
227 sUartComCtrl* pUartCtrl = UART_GetGnssCtrl();
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
228
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
229 if(pUartCtrl == &Uart1Ctrl)
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
230 {
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
231 activeSensor = externalInterface_GetActiveUartSensor();
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
232 gnssState = externalInterface_GetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET);
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
233 }
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
234
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
235 GNSS_Handle.uartWorkingBuffer[writeIndex++] = data;
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
236 if((rxState >= GNSSRX_DETECT_HEADER_2) && (rxState < GNSSRX_READ_CK_A))
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
237 {
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
238 ck_A += data;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
239 ck_B += ck_A;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
240 }
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
241
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
242 switch(rxState)
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
243 {
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
244 case GNSSRX_DETECT_ACK_0:
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
245 case GNSSRX_DETECT_HEADER_0: if(data == 0xB5)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
246 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
247 writeIndex = 0;
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
248 memset(GNSS_Handle.uartWorkingBuffer,0xff, sizeof(GNSS_Handle.uartWorkingBuffer));
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
249 GNSS_Handle.uartWorkingBuffer[writeIndex++] = data;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
250 rxState++;
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
251 ck_A = 0;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
252 ck_B = 0;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
253 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
254 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
255 case GNSSRX_DETECT_ACK_1:
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
256 case GNSSRX_DETECT_HEADER_1: if(data == 0x62)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
257 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
258 rxState++;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
259 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
260 else
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
261 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
262 rxState = GNSSRX_DETECT_HEADER_0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
263 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
264 break;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
265 case GNSSRX_DETECT_ACK_2: if(data == 0x05)
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
266 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
267 rxState++;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
268 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
269 else
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
270 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
271 rxState = GNSSRX_DETECT_HEADER_0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
272 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
273 break;
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
274 case GNSSRX_DETECT_ACK_3: if((data == 0x01))
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
275 {
936
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
276 rxState = GNSSRX_READY;
939
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
277 switch(gnssState)
936
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
278 {
939
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
279 case UART_GNSS_PWRUP: gnssState = UART_GNSS_IDLE;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
280 break;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
281 case UART_GNSS_PWRDOWN: rxState = GNSSRX_DETECT_ACK_0;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
282 UART_Gnss_SendCmd(GNSSCMD_SET_CONFIG);
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
283 gnssState = UART_GNSS_SETCONF;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
284 break;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
285 case UART_GNSS_SETCONF: gnssState = UART_GNSS_INACTIVE;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
286 break;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
287 case UART_GNSS_LOADCONF_0:
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
288 case UART_GNSS_LOADCONF_1: gnssState++;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
289 break;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
290 case UART_GNSS_LOADCONF_2: gnssState = UART_GNSS_SETMODE_MOBILE;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
291 break;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
292 case UART_GNSS_SETMODE_MOBILE: gnssState = UART_GNSS_IDLE;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
293 break;
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
294 default:
f41974734268 Resume UART com with gnss after sleep:
Ideenmodellierer
parents: 936
diff changeset
295 break;
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
296 }
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
297 GnssConnected = 1;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
298 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
299 else
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
300 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
301 rxState = GNSSRX_DETECT_HEADER_0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
302 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
303 break;
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
304 case GNSSRX_DETECT_HEADER_2: if(data == activeRequest.class)
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
305 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
306 rxState++;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
307 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
308 else
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
309 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
310 rxState = GNSSRX_DETECT_HEADER_0;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
311 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
312 break;
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
313 case GNSSRX_DETECT_HEADER_3: if(data == activeRequest.id)
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
314 {
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
315 rxState = GNSSRX_DETECT_LENGTH_0;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
316 }
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
317 else
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
318 {
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
319 rxState = GNSSRX_DETECT_HEADER_0;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
320 }
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
321 break;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
322 case GNSSRX_DETECT_LENGTH_0: rxLength = GNSS_Handle.uartWorkingBuffer[4];
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
323 rxState = GNSSRX_DETECT_LENGTH_1;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
324 break;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
325 case GNSSRX_DETECT_LENGTH_1: rxLength += (GNSS_Handle.uartWorkingBuffer[5] << 8);
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
326 rxState = GNSSRX_READ_DATA;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
327 dataToRead = rxLength;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
328 break;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
329 case GNSSRX_READ_DATA: if(dataToRead > 0)
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
330 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
331 dataToRead--;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
332 }
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
333 if(dataToRead == 0)
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
334 {
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
335 rxState = GNSSRX_READ_CK_A;
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
336 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
337 break;
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
338 case GNSSRX_READ_CK_A: ck_A_Ref = data;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
339 rxState++;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
340 break;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
341 case GNSSRX_READ_CK_B: ck_B_Ref = data;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
342 if((ck_A_Ref == ck_A) && (ck_B_Ref == ck_B))
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
343 {
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
344 switch(gnssState)
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
345 {
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
346 case UART_GNSS_GET_PVT:GNSS_ParsePVTData(&GNSS_Handle);
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
347 break;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
348 case UART_GNSS_GET_SAT: GNSS_ParseNavSatData(&GNSS_Handle);
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
349 break;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
350 default:
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
351 break;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
352 }
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
353 }
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
354 rxState = GNSSRX_DETECT_HEADER_0;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
355 gnssState = UART_GNSS_IDLE;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
356 break;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
357
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
358 default: rxState = GNSSRX_READY;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
359 break;
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
360 }
936
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
361 if(pUartCtrl == &Uart1Ctrl)
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
362 {
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
363 externalInterface_SetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET,gnssState);
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
364 }
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
365 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
366
919
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
367 uint8_t uartGnss_isSensorConnected()
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
368 {
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
369 return GnssConnected;
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
370 }
c0553dd70608 GNSS support for external UART interface:
Ideenmodellierer
parents: 899
diff changeset
371
899
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
372 #endif
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
373