Browse Source

Bluecell Protocol 추가 / PE43711 Value To Hex 로 바꾸는 함수 추가 (수정 필요) / Bluecell Protocol Test Printf 추가

박영준 5 years ago
parent
commit
edf90f4bfe

File diff suppressed because it is too large
+ 200 - 200
.cproject


+ 2 - 2
.settings/language.settings.xml

@@ -4,7 +4,7 @@
4 4
 		<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
5 5
 			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
6 6
 			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
7
-			<provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="1681877287601945682" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
7
+			<provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="564629063996780829" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
8 8
 				<language-scope id="org.eclipse.cdt.core.gcc"/>
9 9
 				<language-scope id="org.eclipse.cdt.core.g++"/>
10 10
 			</provider>
@@ -14,7 +14,7 @@
14 14
 		<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
15 15
 			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
16 16
 			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
17
-			<provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="1681877287601945682" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
17
+			<provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="564629063996780829" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
18 18
 				<language-scope id="org.eclipse.cdt.core.gcc"/>
19 19
 				<language-scope id="org.eclipse.cdt.core.g++"/>
20 20
 			</provider>

+ 2 - 0
.settings/org.eclipse.core.resources.prefs

@@ -0,0 +1,2 @@
1
+eclipse.preferences.version=1
2
+encoding//Bluecell_Src/Bluecell_operate.c=UTF-8

+ 35 - 1
Bluecell_Inc/Bluecell_operate.h

@@ -307,7 +307,41 @@ struct Alarm_UL {
307 307
 	uint8_t ULO_P2_Shutdown   ;
308 308
 	uint8_t ULO_P1_Shutdown   ;
309 309
 };
310
-
310
+enum DATATYPE
311
+{
312
+	ATTDL1  = 0x11,
313
+	ATT_DL1_PATH_OFF = 0x12,
314
+	ATT_DL1_PATH_ON = 0x13,
315
+	ATTUL1  = 0x15,
316
+	ATT_UL1_PATH_OFF = 0x16,
317
+	ATT_UL1_PATH_ON = 0x17,
318
+	ATT_SelfTest1_OFF = 0x18,
319
+	ATT_SelfTest1_ON = 0x19,
320
+	ATTDL2  = 0x21,
321
+	ATT_DL2_PATH_OFF = 0x22,
322
+	ATT_DL2_PATH_ON = 0x23,
323
+	ATTUL2  = 0x25,
324
+	ATT_UL2_PATH_OFF = 0x26,
325
+	ATT_UL2_PATH_ON = 0x27,
326
+	ATT_SelfTest2_OFF = 0x28,
327
+	ATT_SelfTest2_ON = 0x29,
328
+	ATTDL3  = 0x31,
329
+	ATT_DL3_PATH_OFF = 0x32,
330
+	ATT_DL3_PATH_ON = 0x33,
331
+	ATTUL3  = 0x35,
332
+	ATT_UL3_PATH_OFF = 0x36,
333
+	ATT_UL3_PATH_ON = 0x37,
334
+	ATT_SelfTest3_OFF = 0x38,
335
+	ATT_SelfTest3_ON = 0x39,
336
+	ATTDL4  = 0x41,
337
+	ATT_DL4_PATH_OFF = 0x42,
338
+	ATT_DL4_PATH_ON = 0x43,
339
+	ATTUL4  = 0x45,
340
+	ATT_UL4_PATH_OFF = 0x46,
341
+	ATT_UL4_PATH_ON = 0x47,
342
+	ATT_SelfTest4_OFF = 0x48,
343
+	ATT_SelfTest4_ON = 0x49,
344
+};
311 345
 
312 346
 
313 347
 #define ALARM_ENVIRONMENT_FLAG 0x80

+ 170 - 27
Bluecell_Src/Bluecell_operate.c

@@ -52,35 +52,178 @@ typedef enum{
52 52
   BLUECELL_DL_PATH4,
53 53
   BLUECELL_UL_PATH4,
54 54
 };
55
-
55
+typedef enum{
56
+BLUECELL_HEADER,
57
+BLUECELL_TYPE,
58
+BLUECELL_LENGTH,
59
+BLUECELL_CRCINDEX,
60
+BLUECELL_DATA,
61
+};
56 62
 bool Bluecell_Operate(uint8_t* data){
57
-  uint8_t datatype = 0;
63
+  uint8_t datatype = data[BLUECELL_TYPE];
64
+  uint16_t tmp_h = 0,tmp_l = 0;
65
+  double ret = 0 ,tmp = 0.1;
58 66
 
59 67
   switch(datatype){
60
-	case BLUECELL_DL_PATH1:
61
-
62
-        break;
63
-	case BLUECELL_UL_PATH1:
64
-        
65
-        break;
66
-	case BLUECELL_DL_PATH2:
67
-        
68
-        break;
69
-	case BLUECELL_UL_PATH2:
70
-        
71
-        break;
72
-	case BLUECELL_DL_PATH3:
73
-        
74
-        break;
75
-	case BLUECELL_UL_PATH3:
76
-        
77
-        break;
78
-	case BLUECELL_DL_PATH4:
79
-        
80
-        break;
81
-	case BLUECELL_UL_PATH4:
82
-        
83
-        break;
68
+	case ATTDL1 				 :
69
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
70
+		tmp_h = data[BLUECELL_DATA];
71
+		tmp_l = data[BLUECELL_DATA + 1];
72
+		ret += ((tmp_h << 8) & 0xFF00);
73
+		ret += (tmp_l & 0x00FF);
74
+		ret /= 100;
75
+
76
+		printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
77
+		break;
78
+	case ATT_DL1_PATH_OFF 		 :
79
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
80
+		break;
81
+	case ATT_DL1_PATH_ON 		 :
82
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
83
+		break;
84
+	case ATTUL1  				 :
85
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
86
+		tmp_h = data[BLUECELL_DATA];
87
+		tmp_l = data[BLUECELL_DATA + 1];
88
+		ret += ((tmp_h << 8) & 0xFF00);
89
+		ret += (tmp_l & 0x00FF);
90
+		ret /= 100;
91
+
92
+		printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
93
+
94
+		break;
95
+	case ATT_UL1_PATH_OFF        :
96
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
97
+		break;
98
+	case ATT_UL1_PATH_ON 		 :
99
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
100
+		break;
101
+	case ATT_SelfTest1_OFF		 :
102
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
103
+		break;
104
+	case ATT_SelfTest1_ON 		 :
105
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
106
+		break;
107
+	case ATTDL2  				 :
108
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
109
+		tmp_h = data[BLUECELL_DATA];
110
+		tmp_l = data[BLUECELL_DATA + 1];
111
+		ret += ((tmp_h << 8) & 0xFF00);
112
+		ret += (tmp_l & 0x00FF);
113
+		ret /= 100;
114
+
115
+		printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
116
+
117
+		break;
118
+	case ATT_DL2_PATH_OFF		 :
119
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
120
+		break;
121
+	case ATT_DL2_PATH_ON		 :
122
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
123
+		break;
124
+	case ATTUL2  				 :
125
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
126
+		tmp_h = data[BLUECELL_DATA];
127
+		tmp_l = data[BLUECELL_DATA + 1];
128
+		ret += ((tmp_h << 8) & 0xFF00);
129
+		ret += (tmp_l & 0x00FF);
130
+		ret /= 100;
131
+
132
+		printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
133
+
134
+		break;
135
+	case ATT_UL2_PATH_OFF 		 :
136
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
137
+		break;
138
+	case ATT_UL2_PATH_ON		 :
139
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
140
+		break;
141
+	case ATT_SelfTest2_OFF		 :
142
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
143
+		break;
144
+	case ATT_SelfTest2_ON :
145
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
146
+		break;
147
+	case ATTDL3  :
148
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
149
+		tmp_h = data[BLUECELL_DATA];
150
+		tmp_l = data[BLUECELL_DATA + 1];
151
+		ret += ((tmp_h << 8) & 0xFF00);
152
+		ret += (tmp_l & 0x00FF);
153
+		ret /= 100;
154
+
155
+		printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
156
+
157
+		break;
158
+	case ATT_DL3_PATH_OFF :
159
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
160
+		break;
161
+	case ATT_DL3_PATH_ON :
162
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
163
+		break;
164
+	case ATTUL3  :
165
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
166
+		tmp_h = data[BLUECELL_DATA];
167
+		tmp_l = data[BLUECELL_DATA + 1];
168
+		ret += ((tmp_h << 8) & 0xFF00);
169
+		ret += (tmp_l & 0x00FF);
170
+		ret /= 100;
171
+
172
+		printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
173
+
174
+		break;
175
+	case ATT_UL3_PATH_OFF :
176
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
177
+		break;
178
+	case ATT_UL3_PATH_ON :
179
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
180
+		break;
181
+	case ATT_SelfTest3_OFF :
182
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
183
+		break;
184
+	case ATT_SelfTest3_ON :
185
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
186
+		break;
187
+	case ATTDL4  :
188
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
189
+		tmp_h = data[BLUECELL_DATA];
190
+		tmp_l = data[BLUECELL_DATA + 1];
191
+		ret += ((tmp_h << 8) & 0xFF00);
192
+		ret += (tmp_l & 0x00FF);
193
+		ret /= 100;
194
+
195
+		printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
196
+
197
+		break;
198
+	case ATT_DL4_PATH_OFF :
199
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
200
+		break;
201
+	case ATT_DL4_PATH_ON :
202
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
203
+		break;
204
+	case ATTUL4  :
205
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
206
+		tmp_h = data[BLUECELL_DATA];
207
+		tmp_l = data[BLUECELL_DATA + 1];
208
+		ret += ((tmp_h << 8) & 0xFF00);
209
+		ret += (tmp_l & 0x00FF);
210
+		ret /= 100;
211
+
212
+		printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
213
+
214
+		break;
215
+	case ATT_UL4_PATH_OFF:
216
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
217
+		break;
218
+	case ATT_UL4_PATH_ON :
219
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
220
+		break;
221
+	case ATT_SelfTest4_OFF :
222
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
223
+		break;
224
+	case ATT_SelfTest4_ON :
225
+		printf("Function : %s Line %d \r\n",__func__,__LINE__);
226
+		break;
84 227
   }
85 228
   return true;
86 229
 }
@@ -89,7 +232,7 @@ bool MBIC_Operate(uint8_t* data){
89 232
 
90 233
 	switch(datatype){
91 234
 		case Alarm_Bit_List:
92
-			// 알림 비트 
235
+			// �븣由� 鍮꾪듃
93 236
 			Uart1_Data_Send(&Alarm_Status[0],MAX_ALARM_Len);
94 237
 		break;
95 238
 		case Alarm_Mask:

+ 22 - 0
Bluecell_Src/PE43711.c

@@ -110,6 +110,28 @@ void Bit_Compare(PE43711_st ATT,uint8_t data,uint8_t Shift_Index){
110 110
         HAL_GPIO_WritePin(ATT.DATA_PORT,ATT.DATA_PIN,GPIO_PIN_RESET);//DATA
111 111
     }
112 112
 }
113
+
114
+uint8_t PE43711_DataToHexConvert(double val){
115
+	double ref = 0.25;
116
+	uint8_t ret = 0,shift = 0x01;
117
+
118
+	for(int i = 0; i < 8; i++){
119
+		if(val == 0)
120
+			break;
121
+
122
+		if(val < 31.25){
123
+			val -= 16;
124
+
125
+		}
126
+		else{
127
+			return 0b01111111;
128
+		}
129
+
130
+		ref *= 2;
131
+	}
132
+	return;
133
+}
134
+
113 135
 #if 0 // PYJ.2020.04.17_BEGIN -- 
114 136
 void PE43711_ALL_atten_ctrl(ALL_PE43711_st ATT){
115 137
     HAL_GPIO_WritePin(ATT.ATT_DL1.LE_PORT,ATT.ATT_DL1.LE_PIN,GPIO_PIN_RESET);

+ 10 - 4
Bluecell_Src/uart.c

@@ -31,8 +31,8 @@ void InitUartQueue(pUARTQUEUE pQueue)
31 31
 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
32 32
 {
33 33
     pUARTQUEUE pQueue;
34
-    printf("Function : %s : \r\n",__func__);
35
-   // AdcTimerCnt = UartRxTimerCnt = 0;
34
+   // printf("Function : %s : \r\n",__func__);
35
+    UartRxTimerCnt = 0;
36 36
     pQueue = &TerminalQueue;
37 37
     pQueue->head++;
38 38
     if (pQueue->head >= QUEUE_BUFFER_LENGTH) pQueue->head = 0;
@@ -82,11 +82,17 @@ void GetDataFromUartQueue(UART_HandleTypeDef *huart)
82 82
 //        printf("data cnt zero !!!  \r\n");
83 83
         //RF_Ctrl_Main(&uart_buf[Header]);
84 84
 //        HAL_UART_Transmit(dst, &temp_buf[BLUECELL_HEADER00], 11, 3000);
85
-#if 1 // PYJ.2019.07.15_BEGIN -- 
85
+#if 1 // PYJ.2019.07.15_BEGIN --
86 86
             for(int i = 0; i < cnt; i++){
87 87
                 printf("%02x ",uart_buf[i]);
88 88
             }
89
-#endif // PYJ.2019.07.15_END -- 
89
+            printf("CNT : %d",cnt);
90
+#endif // PYJ.2019.07.15_END --
91
+            if(uart_buf[0] == 0xbe){
92
+            	Bluecell_Operate(uart_buf);
93
+            }else{
94
+
95
+            }
90 96
         memset(uart_buf,0x00,cnt);
91 97
 //        for(int i  = 0; i < cnt; i++)
92 98
 //            uart_buf[i] = 0;

+ 1 - 0
Src/main.c

@@ -138,6 +138,7 @@ int main(void)
138 138
   /* Initialize interrupts */
139 139
   MX_NVIC_Init();
140 140
   /* USER CODE BEGIN 2 */
141
+  InitUartQueue(&TerminalQueue);
141 142
   setbuf(stdout, NULL);
142 143
   while(!(HAL_ADCEx_Calibration_Start(&hadc1)==HAL_OK));
143 144
   while(!(HAL_ADCEx_Calibration_Start(&hadc3)==HAL_OK));