annotate Small_CPU/Src/uartProtocol_Sentinel.c @ 842:c3dd461ca3f9 Evo_2_23

Migrated Sentinel protocol to new UART structure: The Sentinel protocol had not been migrated to the new UART structure which was introduced with the introduction of the UART MUX. The Sentinel is now supported by autodetection again (development version only)
author Ideenmodellierer
date Mon, 15 Jan 2024 21:44:18 +0100
parents
children 3e499569baf3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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>&copy; 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 lastAlive = 0;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
76 static uint8_t curAlive = 0;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
77 static uint8_t checksum = 0;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
78 static char checksum_str[]="00";
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
79
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
80 uint8_t activeSensor = externalInterface_GetActiveUartSensor();
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
81 uartSentinelStatus_t localComState = externalInterface_GetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET);
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 switch(rxState)
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 case SENTRX_Ready: if((data >= 'a') && (data <= 'z'))
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
86 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
87 rxState = SENTRX_DetectStart;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
88 curAlive = data;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
89 checksum = 0;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
90 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
91 break;
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 case SENTRX_DetectStart: checksum += data;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
94 if(data == '1')
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 rxState = SENTRX_SelectData;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
97 dataType = 0xFF;
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 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
100 else
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
101 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
102 rxState = SENTRX_Ready;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
103 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
104 break;
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 SENTRX_SelectData: checksum += data;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
107 switch(data)
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
108 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
109 case 'T': dataType = data;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
110 break;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
111 case '0': if(dataType != 0xff)
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
112 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
113 rxState = SENTRX_Data0;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
114 dataValueIdx = 0;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
115 dataValue[0] = 0;
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 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
118 else
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
119 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
120 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 default: rxState = SENTRX_Ready;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
124 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
125 break;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
126
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
127 case SENTRX_Data0:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
128 case SENTRX_Data1:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
129 case SENTRX_Data2:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
130 case SENTRX_Data4:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
131 case SENTRX_Data5:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
132 case SENTRX_Data6:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
133 case SENTRX_Data8:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
134 case SENTRX_Data9:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
135 case SENTRX_Data10: checksum += data;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
136 if((data >= '0') && (data <= '9'))
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 dataValue[dataValueIdx] = dataValue[dataValueIdx] * 10 + (data - '0');
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
139 rxState++;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
140 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
141 else
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
142 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
143 rxState = SENTRX_Ready;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
144 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
145 break;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
146
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
147 case SENTRX_Data3:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
148 case SENTRX_Data7: checksum += data;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
149 if(data == '0')
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
150 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
151 rxState++;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
152 dataValueIdx++;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
153 dataValue[dataValueIdx] = 0;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
154 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
155 else
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
156 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
157 rxState = SENTRX_Ready;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
158 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
159 break;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
160 case SENTRX_Data11: rxState = SENTRX_DataComplete;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
161 ConvertByteToHexString(checksum,checksum_str);
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
162 if(data == checksum_str[0])
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
163 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
164 rxState = SENTRX_DataComplete;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
165 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
166 else
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 rxState = SENTRX_Ready;
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
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
171 break;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
172
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
173 case SENTRX_DataComplete: if(data == checksum_str[1])
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
174 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
175 setExternalInterfaceChannel(0,(float)(dataValue[0] / 10.0));
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
176 setExternalInterfaceChannel(1,(float)(dataValue[1] / 10.0));
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
177 setExternalInterfaceChannel(2,(float)(dataValue[2] / 10.0));
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
178 SentinelConnected = 1;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
179 lastAlive = curAlive;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
180 localComState = UART_SENTINEL_OPERATING;
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 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 default: rxState = SENTRX_Ready;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
187 break;
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 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
190 externalInterface_SetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET,localComState);
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
191 }
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 uint8_t uartSentinel_isSensorConnected()
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
194 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
195 return SentinelConnected;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
196 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
197
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
198 #endif
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
199