annotate Small_CPU/Src/uartProtocol_GNSS.c @ 907:46a21ff3f5ab Evo_2_23

Adaptation custom view deco plan for VPM: The VPM deco plan now shows the start of deco zone as well as the state of the deco table state. In case the table defined when reaching the deco zone is updated then the header line will change to yellow to indicate this. In case a deco stop is missed the head line will change to red.
author ideenmodellierer
date Sun, 13 Oct 2024 18:13:35 +0200
parents 2225c467f1e9
children c0553dd70608
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"
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
27
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
28 #ifdef ENABLE_GNSS
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
29
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
30 static uartGnssStatus_t gnssOpState = UART_GNSS_INIT;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
31 static receiveStateGnss_t rxState = GNSSRX_READY;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
32
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
33 void ConvertByteToHexString(uint8_t byte, char* str)
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
34 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
35 uint8_t worker = 0;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
36 uint8_t digit = 0;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
37 uint8_t digitCnt = 1;
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 worker = byte;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
40 while((worker!=0) && (digitCnt != 255))
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 digit = worker % 16;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
43 if( digit < 10)
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 digit += '0';
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
46 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
47 else
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
48 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
49 digit += 'A' - 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 str[digitCnt--]= digit;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
52 worker = worker / 16;
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 }
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 void uartGnss_Control(void)
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 static uint32_t delayStartTick = 0;
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 uint32_t tick = HAL_GetTick();
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
61
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
62 switch (gnssOpState)
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 case UART_GNSS_INIT: delayStartTick = tick;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
65 gnssOpState = UART_GNSS_LOAD;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
66 break;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
67 case UART_GNSS_LOAD: if(time_elapsed_ms(delayStartTick,HAL_GetTick()) > 1000)
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
68 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
69 GNSS_LoadConfig(&GNSS_Handle);
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
70 gnssOpState = UART_GNSS_GET_ID;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
71 delayStartTick = tick;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
72 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
73 break;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
74 case UART_GNSS_GET_ID: if(time_elapsed_ms(delayStartTick,HAL_GetTick()) > 250)
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
75 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
76 GNSS_GetUniqID(&GNSS_Handle);
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
77 gnssOpState = UART_GNSS_IDLE;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
78 rxState = GNSSRX_RECEIVING;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
79 delayStartTick = tick;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
80 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
81 break;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
82 case UART_GNSS_IDLE: if(time_elapsed_ms(delayStartTick,HAL_GetTick()) > 1000)
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
83 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
84 GNSS_GetPVTData(&GNSS_Handle);
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
85 gnssOpState = UART_GNSS_OPERATING;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
86 rxState = GNSSRX_RECEIVING;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
87 delayStartTick = tick;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
88 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
89 break;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
90 case UART_GNSS_OPERATING: if(time_elapsed_ms(delayStartTick,HAL_GetTick()) > 1000)
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
91 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
92 gnssOpState = UART_GNSS_IDLE; /* simple error handling => start next request */
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
93 rxState = GNSSRX_READY;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
94 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
95 break;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
96 default:
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
97 break;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
98 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
99 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
100
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
101 void uartGnss_ProcessData(void)
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
102 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
103 if(rxState == GNSSRX_RECEIVING)
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
104 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
105 if(GNSS_ParseBuffer(&GNSS_Handle))
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
106 {
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
107 gnssOpState = UART_GNSS_IDLE;
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
108 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
109 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
110 }
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
111
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
112 #endif
2225c467f1e9 Added data path and visualization for position data:
Ideenmodellierer
parents:
diff changeset
113