瀏覽代碼

Status Request 구조체 추가

PYJ 5 年之前
父節點
當前提交
fe2c561e32
共有 3 個文件被更改,包括 156 次插入22 次删除
  1. 62 2
      Bluecell_Inc/Bluecell_operate.h
  2. 90 19
      Bluecell_Src/Bluecell_operate.c
  3. 4 1
      Bluecell_Src/uart.c

+ 62 - 2
Bluecell_Inc/Bluecell_operate.h

@@ -57,7 +57,7 @@ typedef enum{
57 57
 
58 58
 	TableDataReq = 40,
59 59
 
60
-};
60
+}MBICBootProt_st;
61 61
 
62 62
 typedef enum{
63 63
 	MBIC_PREAMBLE_0 = 0,
@@ -86,7 +86,7 @@ typedef enum{
86 86
 	/*
87 87
 	 * PayLoadSTART
88 88
 	 */
89
-};
89
+}MBICProt_st;
90 90
 
91 91
 typedef enum{
92 92
 	Alarm_Bit_List = 0xE000,
@@ -341,6 +341,7 @@ enum DATATYPE
341 341
 	ATT_UL4_PATH_ON = 0x47,
342 342
 	ATT_SelfTest4_OFF = 0x48,
343 343
 	ATT_SelfTest4_ON = 0x49,
344
+	Bluecell_StatusReq = 0x77,
344 345
 };
345 346
 
346 347
 
@@ -442,5 +443,64 @@ typedef struct{
442 443
   uint16_t m24_dBm;
443 444
   uint16_t m25_dBm;
444 445
 }DET_DL;
446
+typedef struct{
447
+    uint8_t bluecell_header;
448
+    uint8_t bluecell_type;
449
+    uint8_t bluecell_length;    
450
+    uint8_t bluecell_crcindex;        
451
+    uint8_t Selftest0;
452
+    uint8_t Selftest1;
453
+    uint8_t Selftest2;
454
+    uint8_t Selftest3;    
455
+    uint8_t ATT_DL1_PATH;    
456
+    uint8_t ATT_DL2_PATH;    
457
+    uint8_t ATT_DL3_PATH;    
458
+    uint8_t ATT_DL4_PATH;        
459
+    uint8_t ATT_UL1_PATH;        
460
+    uint8_t ATT_UL2_PATH;        
461
+    uint8_t ATT_UL3_PATH;        
462
+    uint8_t ATT_UL4_PATH;
463
+    uint8_t ATT_DL1_H;    
464
+    uint8_t ATT_DL1_L;        
465
+    uint8_t ATT_DL2_H;    
466
+    uint8_t ATT_DL2_L;        
467
+    uint8_t ATT_DL3_H;    
468
+    uint8_t ATT_DL3_L;        
469
+    uint8_t ATT_DL4_H;    
470
+    uint8_t ATT_DL4_L;        
471
+    uint8_t ATT_UL1_H;    
472
+    uint8_t ATT_UL1_L;        
473
+    uint8_t ATT_UL2_H;    
474
+    uint8_t ATT_UL2_L;        
475
+    uint8_t ATT_UL3_H;    
476
+    uint8_t ATT_UL3_L;        
477
+    uint8_t ATT_UL4_H;
478
+    uint8_t ATT_UL4_L;
479
+    uint8_t DET_DL1_IN_H;
480
+    uint8_t DET_DL1_IN_L;    
481
+    uint8_t DET_DL2_IN_H;
482
+    uint8_t DET_DL2_IN_L;    
483
+    uint8_t DET_DL3_IN_H;
484
+    uint8_t DET_DL3_IN_L;    
485
+    uint8_t DET_DL4_IN_H;
486
+    uint8_t DET_DL4_IN_L;    
487
+    uint8_t DET_UL1_IN_H;
488
+    uint8_t DET_UL1_IN_L;    
489
+    uint8_t DET_UL2_IN_H;
490
+    uint8_t DET_UL2_IN_L;    
491
+    uint8_t DET_UL3_IN_H;
492
+    uint8_t DET_UL3_IN_L;    
493
+    uint8_t DET_UL4_IN_H;
494
+    uint8_t DET_UL4_IN_L;        
495
+    uint8_t DET_TEMP_H;            
496
+    uint8_t DET_TEMP_L;                
497
+    uint8_t ATT_AGC_ONOFF;
498
+    uint8_t ATT_ALC_ONOFF;
499
+    uint8_t ATT_AGC_H;
500
+    uint8_t ATT_AGC_L;    
501
+    uint8_t ATT_ALC_H;
502
+    uint8_t ATT_ALC_L;    
503
+    uint8_t bluecell_crc;        
504
+}BLUESTATUS_st;
445 505
 
446 506
 #endif /* BLUECELL_OPERATE_H_ */

+ 90 - 19
Bluecell_Src/Bluecell_operate.c

@@ -3,7 +3,8 @@
3 3
 #include "Bluecell_operate.h"
4 4
 #include "PE43711.h"
5 5
 extern volatile uint32_t LedTimerCnt;
6
-
6
+extern void PE43711_atten_ctrl(PE43711_st ATT ,uint8_t data);
7
+extern void Uart1_Data_Send(uint8_t* data,uint8_t size);
7 8
 uint8_t Alarm_Status[MAX_ALARM_Len] = {0,};
8 9
 //uint8_t data123[10000];
9 10
 DET_UL DET_UL1;
@@ -14,7 +15,6 @@ DET_DL DET_DL1;
14 15
 DET_DL DET_DL2;
15 16
 DET_DL DET_DL3;
16 17
 DET_DL DET_DL4;
17
-
18 18
 uint8_t ResultData[1024] = {0,};
19 19
 void Boot_LED_Toggle(void){
20 20
   if(LedTimerCnt > 500){
@@ -51,25 +51,19 @@ uint8_t* MBIC_HeaderDataSetting(uint8_t* data){
51 51
 
52 52
 	return ResultData;
53 53
 }
54
-typedef enum{
55
-  BLUECELL_DL_PATH1 = 0x01,
56
-  BLUECELL_UL_PATH1,
57
-  BLUECELL_DL_PATH2,
58
-  BLUECELL_UL_PATH2,
59
-  BLUECELL_DL_PATH3,
60
-  BLUECELL_UL_PATH3,
61
-  BLUECELL_DL_PATH4,
62
-  BLUECELL_UL_PATH4,
63
-};
54
+
64 55
 typedef enum{
65 56
 BLUECELL_HEADER,
66 57
 BLUECELL_TYPE,
67 58
 BLUECELL_LENGTH,
68 59
 BLUECELL_CRCINDEX,
69 60
 BLUECELL_DATA,
70
-};
61
+}BLUECELLProt_st;
71 62
 
72 63
 extern ALL_PE43711_st ALL_ATT;
64
+BLUESTATUS_st bluecell_datastatus;
65
+
66
+
73 67
 bool Bluecell_Operate(uint8_t* data){
74 68
   uint8_t datatype = data[BLUECELL_TYPE];
75 69
   uint16_t tmp_h = 0,tmp_l = 0;
@@ -85,13 +79,14 @@ bool Bluecell_Operate(uint8_t* data){
85 79
 		ret /= 100;
86 80
         val = PE43711_DataToHexConvert(ret);
87 81
         PE43711_atten_ctrl(ALL_ATT.ATT_DL1,val);
88
-        
89 82
 		printf("ret : %f ,tmp %f \r\n",ret,tmp );
90 83
 		break;
91 84
 	case ATT_DL1_PATH_OFF 		 :
85
+        HAL_GPIO_WritePin(PATH_EN_DL1_GPIO_Port,PATH_EN_DL1_Pin,GPIO_PIN_SET);//CLOCK
92 86
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
93 87
 		break;
94 88
 	case ATT_DL1_PATH_ON 		 :
89
+        HAL_GPIO_WritePin(PATH_EN_DL1_GPIO_Port,PATH_EN_DL1_Pin,GPIO_PIN_RESET);//CLOCK        
95 90
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
96 91
 		break;
97 92
 	case ATTUL1  				 :
@@ -108,9 +103,11 @@ bool Bluecell_Operate(uint8_t* data){
108 103
 
109 104
 		break;
110 105
 	case ATT_UL1_PATH_OFF        :
106
+        HAL_GPIO_WritePin(PATH_EN_UL1_GPIO_Port,PATH_EN_UL1_Pin,GPIO_PIN_SET);//CLOCK
111 107
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
112 108
 		break;
113 109
 	case ATT_UL1_PATH_ON 		 :
110
+        HAL_GPIO_WritePin(PATH_EN_UL1_GPIO_Port,PATH_EN_UL1_Pin,GPIO_PIN_RESET);//CLOCK
114 111
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
115 112
 		break;
116 113
 	case ATT_SelfTest1_OFF		 :
@@ -137,9 +134,11 @@ bool Bluecell_Operate(uint8_t* data){
137 134
 
138 135
 		break;
139 136
 	case ATT_DL2_PATH_OFF		 :
137
+        HAL_GPIO_WritePin(PATH_EN_DL2_GPIO_Port,PATH_EN_DL2_Pin,GPIO_PIN_SET);//CLOCK
140 138
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
141 139
 		break;
142 140
 	case ATT_DL2_PATH_ON		 :
141
+        HAL_GPIO_WritePin(PATH_EN_DL2_GPIO_Port,PATH_EN_DL2_Pin,GPIO_PIN_RESET);//CLOCK
143 142
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
144 143
 		break;
145 144
 	case ATTUL2  				 :
@@ -156,9 +155,11 @@ bool Bluecell_Operate(uint8_t* data){
156 155
 
157 156
 		break;
158 157
 	case ATT_UL2_PATH_OFF 		 :
158
+        HAL_GPIO_WritePin(PATH_EN_UL2_GPIO_Port,PATH_EN_UL2_Pin,GPIO_PIN_SET);//CLOCK
159 159
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
160 160
 		break;
161 161
 	case ATT_UL2_PATH_ON		 :
162
+        HAL_GPIO_WritePin(PATH_EN_UL2_GPIO_Port,PATH_EN_UL2_Pin,GPIO_PIN_RESET);//CLOCK
162 163
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
163 164
 		break;
164 165
 	case ATT_SelfTest2_OFF		 :
@@ -186,9 +187,11 @@ bool Bluecell_Operate(uint8_t* data){
186 187
 
187 188
 		break;
188 189
 	case ATT_DL3_PATH_OFF :
190
+        HAL_GPIO_WritePin(PATH_EN_DL3_GPIO_Port,PATH_EN_DL3_Pin,GPIO_PIN_SET);//CLOCK
189 191
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
190 192
 		break;
191 193
 	case ATT_DL3_PATH_ON :
194
+        HAL_GPIO_WritePin(PATH_EN_DL3_GPIO_Port,PATH_EN_DL3_Pin,GPIO_PIN_RESET);//CLOCK
192 195
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
193 196
 		break;
194 197
 	case ATTUL3  :
@@ -205,9 +208,11 @@ bool Bluecell_Operate(uint8_t* data){
205 208
 
206 209
 		break;
207 210
 	case ATT_UL3_PATH_OFF :
211
+        HAL_GPIO_WritePin(PATH_EN_UL3_GPIO_Port,PATH_EN_UL3_Pin,GPIO_PIN_SET);//CLOCK
208 212
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
209 213
 		break;
210 214
 	case ATT_UL3_PATH_ON :
215
+        HAL_GPIO_WritePin(PATH_EN_UL3_GPIO_Port,PATH_EN_UL3_Pin,GPIO_PIN_RESET);//CLOCK
211 216
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
212 217
 		break;
213 218
 	case ATT_SelfTest3_OFF :
@@ -236,14 +241,11 @@ bool Bluecell_Operate(uint8_t* data){
236 241
 
237 242
 		break;
238 243
 	case ATT_DL4_PATH_OFF :
239
-        HAL_GPIO_WritePin(_PATH_SW4_GPIO_Port,_PATH_SW4_Pin,GPIO_PIN_RESET);//CLOCK
240
-        HAL_GPIO_WritePin(PATH_SW4_GPIO_Port,PATH_SW4_Pin,GPIO_PIN_SET);//CLOCK
244
+        HAL_GPIO_WritePin(PATH_EN_DL4_GPIO_Port,PATH_EN_DL4_Pin,GPIO_PIN_SET);//CLOCK        
241 245
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
242 246
 		break;
243 247
 	case ATT_DL4_PATH_ON :
244
-        HAL_GPIO_WritePin(_PATH_SW4_GPIO_Port,_PATH_SW4_Pin,GPIO_PIN_SET);//CLOCK
245
-        HAL_GPIO_WritePin(PATH_SW4_GPIO_Port,PATH_SW4_Pin,GPIO_PIN_RESET);//CLOCK
246
-        
248
+        HAL_GPIO_WritePin(PATH_EN_DL4_GPIO_Port,PATH_EN_DL4_Pin,GPIO_PIN_RESET);//CLOCK
247 249
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
248 250
 		break;
249 251
 	case ATTUL4  :
@@ -260,20 +262,89 @@ bool Bluecell_Operate(uint8_t* data){
260 262
 
261 263
 		break;
262 264
 	case ATT_UL4_PATH_OFF:
265
+        HAL_GPIO_WritePin(PATH_EN_UL4_GPIO_Port,PATH_EN_UL4_Pin,GPIO_PIN_SET);//CLOCK
263 266
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
264 267
 		break;
265 268
 	case ATT_UL4_PATH_ON :
269
+        HAL_GPIO_WritePin(PATH_EN_UL4_GPIO_Port,PATH_EN_UL4_Pin,GPIO_PIN_RESET);//CLOCK
266 270
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
267 271
 		break;
268 272
 	case ATT_SelfTest4_OFF :
273
+        HAL_GPIO_WritePin(_PATH_SW4_GPIO_Port,_PATH_SW4_Pin,GPIO_PIN_RESET);//CLOCK
274
+        HAL_GPIO_WritePin(PATH_SW4_GPIO_Port,PATH_SW4_Pin,GPIO_PIN_SET);//CLOCK
269 275
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
270 276
 		break;
271 277
 	case ATT_SelfTest4_ON :
278
+        HAL_GPIO_WritePin(_PATH_SW4_GPIO_Port,_PATH_SW4_Pin,GPIO_PIN_SET);//CLOCK
279
+        HAL_GPIO_WritePin(PATH_SW4_GPIO_Port,PATH_SW4_Pin,GPIO_PIN_RESET);//CLOCK
272 280
 		printf("Function : %s Line %d \r\n",__func__,__LINE__);
273 281
 		break;
282
+    case Bluecell_StatusReq:
283
+        DataStatusGet();
284
+        Uart1_Data_Send(&bluecell_datastatus, sizeof(bluecell_datastatus));
285
+        break;
274 286
   }
275 287
   return true;
276 288
 }
289
+void DataStatusGet(void){
290
+        bluecell_datastatus.bluecell_header = 0xbe;
291
+        bluecell_datastatus.bluecell_type = Bluecell_StatusReq;
292
+        bluecell_datastatus.bluecell_length = sizeof(bluecell_datastatus) - 1;    
293
+        bluecell_datastatus.bluecell_crcindex = 56;
294
+        bluecell_datastatus.Selftest0 = HAL_GPIO_ReadPin(_PATH_SW1_GPIO_Port,_PATH_SW1_Pin);
295
+        bluecell_datastatus.Selftest1 = HAL_GPIO_ReadPin(_PATH_SW2_GPIO_Port,_PATH_SW2_Pin);
296
+        bluecell_datastatus.Selftest2 = HAL_GPIO_ReadPin(_PATH_SW3_GPIO_Port,_PATH_SW3_Pin);
297
+        bluecell_datastatus.Selftest3 = HAL_GPIO_ReadPin(_PATH_SW4_GPIO_Port,_PATH_SW4_Pin);
298
+        bluecell_datastatus.ATT_DL1_PATH = HAL_GPIO_ReadPin(PATH_EN_DL1_GPIO_Port,PATH_EN_UL1_Pin);//CLOCK;
299
+        bluecell_datastatus.ATT_DL2_PATH = HAL_GPIO_ReadPin(PATH_EN_DL2_GPIO_Port,PATH_EN_UL2_Pin);//CLOCK;
300
+        bluecell_datastatus.ATT_DL3_PATH = HAL_GPIO_ReadPin(PATH_EN_DL3_GPIO_Port,PATH_EN_UL3_Pin);//CLOCK;
301
+        bluecell_datastatus.ATT_DL4_PATH = HAL_GPIO_ReadPin(PATH_EN_DL4_GPIO_Port,PATH_EN_UL4_Pin);//CLOCK;
302
+        bluecell_datastatus.ATT_UL1_PATH = HAL_GPIO_ReadPin(PATH_EN_UL1_GPIO_Port,PATH_EN_UL1_Pin);//CLOCK;
303
+        bluecell_datastatus.ATT_UL2_PATH = HAL_GPIO_ReadPin(PATH_EN_UL2_GPIO_Port,PATH_EN_UL2_Pin);//CLOCK;
304
+        bluecell_datastatus.ATT_UL3_PATH = HAL_GPIO_ReadPin(PATH_EN_UL3_GPIO_Port,PATH_EN_UL3_Pin);//CLOCK;
305
+        bluecell_datastatus.ATT_UL4_PATH = HAL_GPIO_ReadPin(PATH_EN_UL4_GPIO_Port,PATH_EN_UL4_Pin);//CLOCK;
306
+        bluecell_datastatus.ATT_DL1_H ;
307
+        bluecell_datastatus.ATT_DL1_L;
308
+        bluecell_datastatus.ATT_DL2_H;
309
+        bluecell_datastatus.ATT_DL2_L;
310
+        bluecell_datastatus.ATT_DL3_H;
311
+        bluecell_datastatus.ATT_DL3_L;
312
+        bluecell_datastatus.ATT_DL4_H;
313
+        bluecell_datastatus.ATT_DL4_L;
314
+        bluecell_datastatus.ATT_UL1_H;
315
+        bluecell_datastatus.ATT_UL1_L;
316
+        bluecell_datastatus.ATT_UL2_H;
317
+        bluecell_datastatus.ATT_UL2_L;
318
+        bluecell_datastatus.ATT_UL3_H;
319
+        bluecell_datastatus.ATT_UL3_L;
320
+        bluecell_datastatus.ATT_UL4_H;
321
+        bluecell_datastatus.ATT_UL4_L;
322
+        bluecell_datastatus.DET_DL1_IN_H;
323
+        bluecell_datastatus.DET_DL1_IN_L;
324
+        bluecell_datastatus.DET_DL2_IN_H;
325
+        bluecell_datastatus.DET_DL2_IN_L;
326
+        bluecell_datastatus.DET_DL3_IN_H;
327
+        bluecell_datastatus.DET_DL3_IN_L;
328
+        bluecell_datastatus.DET_DL4_IN_H;
329
+        bluecell_datastatus.DET_DL4_IN_L;
330
+        bluecell_datastatus.DET_UL1_IN_H;
331
+        bluecell_datastatus.DET_UL1_IN_L;
332
+        bluecell_datastatus.DET_UL2_IN_H;
333
+        bluecell_datastatus.DET_UL2_IN_L;
334
+        bluecell_datastatus.DET_UL3_IN_H;
335
+        bluecell_datastatus.DET_UL3_IN_L;
336
+        bluecell_datastatus.DET_UL4_IN_H;
337
+        bluecell_datastatus.DET_UL4_IN_L;
338
+        bluecell_datastatus.DET_TEMP_H;
339
+        bluecell_datastatus.DET_TEMP_L;
340
+        bluecell_datastatus.ATT_AGC_ONOFF;
341
+        bluecell_datastatus.ATT_ALC_ONOFF;
342
+        bluecell_datastatus.ATT_AGC_H;
343
+        bluecell_datastatus.ATT_AGC_L;
344
+        bluecell_datastatus.ATT_ALC_H;
345
+        bluecell_datastatus.ATT_ALC_L;
346
+}
347
+
277 348
 bool MBIC_Operate(uint8_t* data){
278 349
 	uint16_t datatype = 0;
279 350
 

+ 4 - 1
Bluecell_Src/uart.c

@@ -9,12 +9,15 @@
9 9
 #include "uart.h"
10 10
 
11 11
 #include "string.h"
12
+#include "Bluecell_operate.h"
13
+
14
+
12 15
 
13 16
 UARTQUEUE TerminalQueue;
14 17
 UARTQUEUE WifiQueue;
15 18
 uart_hal_tx_type uart_hal_tx;
16 19
 extern volatile uint32_t UartRxTimerCnt;
17
-
20
+extern bool Bluecell_Operate(uint8_t* data);
18 21
 void InitUartQueue(pUARTQUEUE pQueue)
19 22
 {
20 23
   setbuf(stdout, NULL);