Mercurial > public > ostc4
annotate Small_CPU/Src/uartProtocol_Sentinel.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 | 3e499569baf3 |
children |
rev | line source |
---|---|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
1 /** |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
2 ****************************************************************************** |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
3 * @file uartProtocol_Co2.c |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
4 * @author heinrichs weikamp gmbh |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
5 * @version V0.0.1 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
6 * @date 15-Jan-2024 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
7 * @brief Interface functionality to read data from Sentinel rebreather |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
8 * |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
9 @verbatim |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
10 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
11 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
12 @endverbatim |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
13 ****************************************************************************** |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
14 * @attention |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
15 * |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
16 * <h2><center>© COPYRIGHT(c) 2024 heinrichs weikamp</center></h2> |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
17 * |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
18 ****************************************************************************** |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
19 */ |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
20 /* Includes ------------------------------------------------------------------*/ |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
21 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
22 #include <string.h> |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
23 #include <uartProtocol_Sentinel.h> |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
24 #include "uart.h" |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
25 #include "externalInterface.h" |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
26 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
27 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
28 #ifdef ENABLE_SENTINEL_MODE |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
29 static uint8_t SentinelConnected = 0; /* Binary indicator if a sensor is connected or not */ |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
30 static receiveStateSentinel_t rxState = SENTRX_Ready; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
31 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
32 void ConvertByteToHexString(uint8_t byte, char* str) |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
33 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
34 uint8_t worker = 0; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
35 uint8_t digit = 0; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
36 uint8_t digitCnt = 1; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
37 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
38 worker = byte; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
39 while((worker!=0) && (digitCnt != 255)) |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
40 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
41 digit = worker % 16; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
42 if( digit < 10) |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
43 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
44 digit += '0'; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
45 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
46 else |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
47 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
48 digit += 'A' - 10; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
49 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
50 str[digitCnt--]= digit; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
51 worker = worker / 16; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
52 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
53 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
54 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
55 void uartSentinel_Control(void) |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
56 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
57 uint8_t activeSensor = externalInterface_GetActiveUartSensor(); |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
58 uartSentinelStatus_t localComState = externalInterface_GetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET); |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
59 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
60 if(localComState == UART_SENTINEL_INIT) |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
61 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
62 SentinelConnected = 0; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
63 UART_StartDMA_Receiption(); |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
64 localComState = UART_SENTINEL_IDLE; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
65 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
66 externalInterface_SetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET,localComState); |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
67 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
68 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
69 void uartSentinel_ProcessData(uint8_t data) |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
70 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
71 static uint8_t dataType = 0; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
72 static uint32_t dataValue[3]; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
73 static uint8_t dataValueIdx = 0; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
74 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
75 static uint8_t checksum = 0; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
76 static char checksum_str[]="00"; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
77 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
78 uint8_t activeSensor = externalInterface_GetActiveUartSensor(); |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
79 uartSentinelStatus_t localComState = externalInterface_GetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET); |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
80 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
81 switch(rxState) |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
82 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
83 case SENTRX_Ready: if((data >= 'a') && (data <= 'z')) |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
84 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
85 rxState = SENTRX_DetectStart; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
86 checksum = 0; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
87 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
88 break; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
89 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
90 case SENTRX_DetectStart: checksum += data; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
91 if(data == '1') |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
92 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
93 rxState = SENTRX_SelectData; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
94 dataType = 0xFF; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
95 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
96 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
97 else |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
98 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
99 rxState = SENTRX_Ready; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
100 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
101 break; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
102 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
103 case SENTRX_SelectData: checksum += data; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
104 switch(data) |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
105 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
106 case 'T': dataType = data; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
107 break; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
108 case '0': if(dataType != 0xff) |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
109 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
110 rxState = SENTRX_Data0; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
111 dataValueIdx = 0; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
112 dataValue[0] = 0; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
113 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
114 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
115 else |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
116 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
117 rxState = SENTRX_Ready; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
118 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
119 break; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
120 default: rxState = SENTRX_Ready; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
121 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
122 break; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
123 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
124 case SENTRX_Data0: |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
125 case SENTRX_Data1: |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
126 case SENTRX_Data2: |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
127 case SENTRX_Data4: |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
128 case SENTRX_Data5: |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
129 case SENTRX_Data6: |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
130 case SENTRX_Data8: |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
131 case SENTRX_Data9: |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
132 case SENTRX_Data10: checksum += data; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
133 if((data >= '0') && (data <= '9')) |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
134 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
135 dataValue[dataValueIdx] = dataValue[dataValueIdx] * 10 + (data - '0'); |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
136 rxState++; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
137 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
138 else |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
139 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
140 rxState = SENTRX_Ready; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
141 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
142 break; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
143 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
144 case SENTRX_Data3: |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
145 case SENTRX_Data7: checksum += data; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
146 if(data == '0') |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
147 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
148 rxState++; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
149 dataValueIdx++; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
150 dataValue[dataValueIdx] = 0; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
151 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
152 else |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
153 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
154 rxState = SENTRX_Ready; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
155 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
156 break; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
157 case SENTRX_Data11: rxState = SENTRX_DataComplete; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
158 ConvertByteToHexString(checksum,checksum_str); |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
159 if(data == checksum_str[0]) |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
160 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
161 rxState = SENTRX_DataComplete; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
162 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
163 else |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
164 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
165 rxState = SENTRX_Ready; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
166 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
167 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
168 break; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
169 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
170 case SENTRX_DataComplete: if(data == checksum_str[1]) |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
171 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
172 setExternalInterfaceChannel(0,(float)(dataValue[0] / 10.0)); |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
173 setExternalInterfaceChannel(1,(float)(dataValue[1] / 10.0)); |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
174 setExternalInterfaceChannel(2,(float)(dataValue[2] / 10.0)); |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
175 SentinelConnected = 1; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
176 localComState = UART_SENTINEL_OPERATING; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
177 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
178 rxState = SENTRX_Ready; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
179 break; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
180 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
181 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
182 default: rxState = SENTRX_Ready; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
183 break; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
184 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
185 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
186 externalInterface_SetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET,localComState); |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
187 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
188 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
189 uint8_t uartSentinel_isSensorConnected() |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
190 { |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
191 return SentinelConnected; |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
192 } |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
193 |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
194 #endif |
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
195 |