annotate Small_CPU/Src/uartProtocol_Sentinel.c @ 935:f2494a708f52 Evo_2_23

Added unit files for GPIO: The new gpios need to be accessed from severall units. That's why the current, static implementation in the baseCPU did not fit. To enable global usage of the function they have been moved into new source / header file
author Ideenmodellierer
date Sun, 08 Dec 2024 21:59:22 +0100
parents effadaa3a1f7
children
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
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 860
diff changeset
32 extern sUartComCtrl Uart1Ctrl;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 860
diff changeset
33
842
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
34 void ConvertByteToHexString(uint8_t byte, char* str)
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
35 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
36 uint8_t worker = 0;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
37 uint8_t digit = 0;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
38 uint8_t digitCnt = 1;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
39
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
40 worker = byte;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
41 while((worker!=0) && (digitCnt != 255))
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
42 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
43 digit = worker % 16;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
44 if( digit < 10)
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 digit += '0';
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 else
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 digit += 'A' - 10;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
51 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
52 str[digitCnt--]= digit;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
53 worker = worker / 16;
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 }
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 void uartSentinel_Control(void)
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
58 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
59 uint8_t activeSensor = externalInterface_GetActiveUartSensor();
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
60 uartSentinelStatus_t localComState = externalInterface_GetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET);
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 if(localComState == UART_SENTINEL_INIT)
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
63 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
64 SentinelConnected = 0;
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 860
diff changeset
65 UART_StartDMA_Receiption(&Uart1Ctrl);
842
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
66 localComState = UART_SENTINEL_IDLE;
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 externalInterface_SetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET,localComState);
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
69 }
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 void uartSentinel_ProcessData(uint8_t data)
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
72 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
73 static uint8_t dataType = 0;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
74 static uint32_t dataValue[3];
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
75 static uint8_t dataValueIdx = 0;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
76
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 checksum = 0;
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 break;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
91
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
92 case SENTRX_DetectStart: checksum += data;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
93 if(data == '1')
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
94 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
95 rxState = SENTRX_SelectData;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
96 dataType = 0xFF;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
97
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 else
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 rxState = SENTRX_Ready;
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 break;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
104
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
105 case SENTRX_SelectData: checksum += data;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
106 switch(data)
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
107 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
108 case 'T': dataType = data;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
109 break;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
110 case '0': if(dataType != 0xff)
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
111 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
112 rxState = SENTRX_Data0;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
113 dataValueIdx = 0;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
114 dataValue[0] = 0;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
115
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 else
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 rxState = SENTRX_Ready;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
120 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
121 break;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
122 default: rxState = SENTRX_Ready;
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 break;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
125
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
126 case SENTRX_Data0:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
127 case SENTRX_Data1:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
128 case SENTRX_Data2:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
129 case SENTRX_Data4:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
130 case SENTRX_Data5:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
131 case SENTRX_Data6:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
132 case SENTRX_Data8:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
133 case SENTRX_Data9:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
134 case SENTRX_Data10: checksum += data;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
135 if((data >= '0') && (data <= '9'))
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
136 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
137 dataValue[dataValueIdx] = dataValue[dataValueIdx] * 10 + (data - '0');
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
138 rxState++;
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 else
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 rxState = SENTRX_Ready;
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 break;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
145
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
146 case SENTRX_Data3:
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
147 case SENTRX_Data7: checksum += data;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
148 if(data == '0')
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
149 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
150 rxState++;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
151 dataValueIdx++;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
152 dataValue[dataValueIdx] = 0;
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 else
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 rxState = SENTRX_Ready;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
157 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
158 break;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
159 case SENTRX_Data11: rxState = SENTRX_DataComplete;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
160 ConvertByteToHexString(checksum,checksum_str);
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
161 if(data == checksum_str[0])
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 rxState = SENTRX_DataComplete;
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 else
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 rxState = SENTRX_Ready;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
168 }
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 break;
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 case SENTRX_DataComplete: if(data == checksum_str[1])
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
173 {
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
174 setExternalInterfaceChannel(0,(float)(dataValue[0] / 10.0));
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
175 setExternalInterfaceChannel(1,(float)(dataValue[1] / 10.0));
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
176 setExternalInterfaceChannel(2,(float)(dataValue[2] / 10.0));
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
177 SentinelConnected = 1;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
178 localComState = UART_SENTINEL_OPERATING;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
179 }
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
180 rxState = SENTRX_Ready;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
181 break;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
182
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
183
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
184 default: rxState = SENTRX_Ready;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
185 break;
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
186
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 externalInterface_SetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET,localComState);
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
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
191 uint8_t uartSentinel_isSensorConnected()
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 return SentinelConnected;
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
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
196 #endif
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff changeset
197