|
@@ -9,85 +9,58 @@
|
9
|
9
|
|
10
|
10
|
extern volatile uint32_t LedTimerCnt;
|
11
|
11
|
extern volatile uint32_t AdcTimerCnt;
|
|
12
|
+
|
|
13
|
+/***************************************************************************************/
|
|
14
|
+/* Extern Function */
|
|
15
|
+/***************************************************************************************/
|
|
16
|
+
|
12
|
17
|
extern void PE43711_atten_ctrl(PE43711_st ATT ,uint8_t data);
|
13
|
18
|
extern void Uart1_Data_Send(uint8_t* data,uint8_t size);
|
|
19
|
+extern HAL_StatusTypeDef EEPROM_M24C08_Zerowrite(uint8_t devid,uint16_t Address);
|
|
20
|
+/***************************************************************************************/
|
|
21
|
+/* Extern Valuable */
|
|
22
|
+/***************************************************************************************/
|
|
23
|
+extern volatile bool AlarmTimerOnSet;
|
|
24
|
+extern volatile bool AlarmTimerOffSet;
|
|
25
|
+extern volatile uint32_t AlarmTimerOnCnt;
|
|
26
|
+extern volatile uint32_t AlarmTimerOffCnt;
|
|
27
|
+
|
|
28
|
+extern ALL_PE43711_st ALL_ATT;
|
|
29
|
+extern volatile uint32_t ADC1_Average_value[4];
|
|
30
|
+extern volatile uint32_t ADC3_Average_value[5];
|
|
31
|
+extern volatile uint16_t ADC1valuearray[4][ADC_AVERAGECNT];
|
|
32
|
+extern volatile uint16_t ADC3valuearray[5][ADC_AVERAGECNT];
|
|
33
|
+
|
|
34
|
+/***************************************************************************************/
|
|
35
|
+/* Function */
|
|
36
|
+/***************************************************************************************/
|
|
37
|
+
|
14
|
38
|
double AutoControl_ADC_Compare(double CurrentAdc,uint8_t* CompareAdc,uint8_t size);
|
15
|
39
|
void Bluecell_StructCpy(uint8_t* dst,uint8_t* src,uint16_t size);
|
16
|
40
|
void DataStatusSet(void);
|
17
|
41
|
void Alarm_Check();
|
|
42
|
+double TableAtteGuarantee(uint8_t* Table,double AttenValue);
|
|
43
|
+uint8_t PE43711_Calc(uint8_t* Table,uint8_t high_bit,uint8_t low_bit,uint8_t offset_h,uint8_t offset_l);
|
|
44
|
+uint8_t PE43711_Calc_NoTable(uint8_t high_bit,uint8_t low_bit);
|
|
45
|
+double PE43711_Double(uint8_t high_bit,uint8_t low_bit);
|
|
46
|
+void Booting_LED_Check(void);
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+/***************************************************************************************/
|
|
52
|
+/* Valuable */
|
|
53
|
+/***************************************************************************************/
|
18
|
54
|
|
19
|
55
|
uint8_t Alarm_Status[MAX_ALARM_Len] = {0,};
|
20
|
|
-//uint8_t data123[10000];
|
21
|
56
|
uint8_t ResultData[1024] = {0,};
|
22
|
57
|
uint8_t DataWrite[sizeof(BLUESTATUS_st)] = {0,};
|
23
|
58
|
uint8_t DataRead[512] = {0,};
|
24
|
|
-extern volatile bool AlarmTimerSet;
|
25
|
|
-extern volatile uint32_t AlarmTimerCnt;
|
26
|
|
-
|
27
|
|
-
|
28
|
|
-typedef enum{
|
29
|
|
-BLUECELL_HEADER,
|
30
|
|
-BLUECELL_TYPE,
|
31
|
|
-BLUECELL_LENGTH,
|
32
|
|
-BLUECELL_CRCINDEX,
|
33
|
|
-BLUECELL_DATA,
|
34
|
|
-}BLUECELLProt_st;
|
35
|
|
-
|
36
|
|
-
|
37
|
|
-typedef enum{
|
38
|
|
- Bluecell_Table_ATT_DL1 = 0,
|
39
|
|
- Bluecell_Table_ATT_UL1,
|
40
|
|
- Bluecell_Table_ATT_DL2,
|
41
|
|
- Bluecell_Table_ATT_UL2,
|
42
|
|
- Bluecell_Table_ATT_DL3,
|
43
|
|
- Bluecell_Table_ATT_UL3,
|
44
|
|
- Bluecell_Table_ATT_DL4,
|
45
|
|
- Bluecell_Table_ATT_UL4,
|
46
|
|
- Bluecell_Table_DET_DL1,
|
47
|
|
- Bluecell_Table_DET_UL1,
|
48
|
|
- Bluecell_Table_DET_DL2,
|
49
|
|
- Bluecell_Table_DET_UL2,
|
50
|
|
- Bluecell_Table_DET_DL3,
|
51
|
|
- Bluecell_Table_DET_UL3,
|
52
|
|
- Bluecell_Table_DET_DL4,
|
53
|
|
- Bluecell_Table_DET_UL4,
|
54
|
|
- Bluecell_Table_TEMP_DL1,
|
55
|
|
- Bluecell_Table_TEMP_UL1,
|
56
|
|
- Bluecell_Table_TEMP_DL2,
|
57
|
|
- Bluecell_Table_TEMP_UL2,
|
58
|
|
- Bluecell_Table_TEMP_DL3,
|
59
|
|
- Bluecell_Table_TEMP_UL3,
|
60
|
|
- Bluecell_Table_TEMP_DL4,
|
61
|
|
- Bluecell_Table_TEMP_UL4,
|
62
|
|
-}Bluecell_tableIndex;
|
63
|
|
-typedef enum{
|
64
|
|
- MBIC_PROT_PREAMBLE0_INDEX,
|
65
|
|
- MBIC_PROT_PREAMBLE1_INDEX,
|
66
|
|
- MBIC_PROT_PREAMBLE2_INDEX,
|
67
|
|
- MBIC_PROT_PREAMBLE3_INDEX,
|
68
|
|
- MBIC_PROT_SUB_UID0_INDEX,
|
69
|
|
- MBIC_PROT_SUB_UID1_INDEX,
|
70
|
|
- MBIC_PROT_R_CODE_INDEX,
|
71
|
|
- MBIC_PROT_TR_ID0_INDEX,
|
72
|
|
- MBIC_PROT_TR_ID1_INDEX,
|
73
|
|
- MBIC_PROT_SEQ_NUM_INDEX,
|
74
|
|
- MBIC_PROT_TTL_INDEX,
|
75
|
|
- MBIC_PROT_TIME0_INDEX,
|
76
|
|
- MBIC_PROT_TIME1_INDEX,
|
77
|
|
- MBIC_PROT_TIME2_INDEX,
|
78
|
|
- MBIC_PROT_TIME3_INDEX,
|
79
|
|
- MBIC_PROT_TIME4_INDEX,
|
80
|
|
- MBIC_PROT_TIME5_INDEX,
|
81
|
|
- MBIC_PROT_ERR_RESP_INDEX,
|
82
|
|
- MBIC_PROT_CMD_INDEX,
|
83
|
|
- MBIC_PROT_LENGTH_INDEX,
|
84
|
|
- MBIC_PROT_HEADERCHECKSUM_INDEX,
|
85
|
|
- MBIC_PROT_SUB_DATA_INDEX,
|
86
|
|
-
|
87
|
|
- MBIC_PROT_INDEX_MAX,
|
|
59
|
+uint8_t Txdata[512];
|
|
60
|
+int8_t AutoControl_Save[sizeof(ALC_dBm_t)];
|
|
61
|
+uint16_t ADC1Ret[4];
|
|
62
|
+uint16_t ADC3Ret[5];
|
88
|
63
|
|
89
|
|
-};
|
90
|
|
-
|
91
|
64
|
ATT_TABLE_st Att_DL1;
|
92
|
65
|
ATT_TABLE_st Att_DL2;
|
93
|
66
|
ATT_TABLE_st Att_DL3;
|
|
@@ -116,102 +89,10 @@ TEMP_TABLE_st Temp_UL1;
|
116
|
89
|
TEMP_TABLE_st Temp_UL2;
|
117
|
90
|
TEMP_TABLE_st Temp_UL3;
|
118
|
91
|
TEMP_TABLE_st Temp_UL4;
|
119
|
|
-extern ALL_PE43711_st ALL_ATT;
|
|
92
|
+
|
120
|
93
|
BLUESTATUS_st bluecell_Currdatastatus;
|
121
|
94
|
BLUESTATUS_st bluecell_Prevdatastatus;
|
122
|
|
-typedef struct{
|
123
|
|
- bool AGC1_En;
|
124
|
|
- bool AGC2_En;
|
125
|
|
- bool AGC3_En;
|
126
|
|
- bool AGC4_En;
|
127
|
|
- bool ALC1_En;
|
128
|
|
- bool ALC2_En;
|
129
|
|
- bool ALC3_En;
|
130
|
|
- bool ALC4_En;
|
131
|
|
-}AutoCtrl_st;
|
132
|
|
-
|
133
|
|
-//5~ - 25
|
134
|
|
-typedef struct{
|
135
|
|
- int8_t DET_DL_0;
|
136
|
|
- int8_t DET_DL_1;
|
137
|
|
- int8_t DET_DL_2;
|
138
|
|
- int8_t DET_DL_3;
|
139
|
|
- int8_t DET_DL_4;
|
140
|
|
- int8_t DET_DL_5;
|
141
|
|
- int8_t DET_DL_6;
|
142
|
|
- int8_t DET_DL_7;
|
143
|
|
- int8_t DET_DL_8;
|
144
|
|
- int8_t DET_DL_9;
|
145
|
|
- int8_t DET_DL_10;
|
146
|
|
- int8_t DET_DL_11;
|
147
|
|
- int8_t DET_DL_12;
|
148
|
|
- int8_t DET_DL_13;
|
149
|
|
- int8_t DET_DL_14;
|
150
|
|
- int8_t DET_DL_15;
|
151
|
|
- int8_t DET_DL_16;
|
152
|
|
- int8_t DET_DL_17;
|
153
|
|
- int8_t DET_DL_18;
|
154
|
|
- int8_t DET_DL_19;
|
155
|
|
- int8_t DET_DL_20;
|
156
|
|
- int8_t DET_DL_21;
|
157
|
|
- int8_t DET_DL_22;
|
158
|
|
- int8_t DET_DL_23;
|
159
|
|
- int8_t DET_DL_24;
|
160
|
|
- int8_t DET_DL_25;
|
161
|
|
- int8_t DET_DL_26;
|
162
|
|
- int8_t DET_DL_27;
|
163
|
|
- int8_t DET_DL_28;
|
164
|
|
- int8_t DET_DL_29;
|
165
|
|
- int8_t DET_DL_30;
|
166
|
|
-}AGC_dBm_t;
|
167
|
|
-typedef struct{
|
168
|
|
- int8_t DET_UL_0;
|
169
|
|
- int8_t DET_UL_1;
|
170
|
|
- int8_t DET_UL_2;
|
171
|
|
- int8_t DET_UL_3;
|
172
|
|
- int8_t DET_UL_4;
|
173
|
|
- int8_t DET_UL_5;
|
174
|
|
- int8_t DET_UL_6;
|
175
|
|
- int8_t DET_UL_7;
|
176
|
|
- int8_t DET_UL_8;
|
177
|
|
- int8_t DET_UL_9;
|
178
|
|
- int8_t DET_UL_10;
|
179
|
|
- int8_t DET_UL_11;
|
180
|
|
- int8_t DET_UL_12;
|
181
|
|
- int8_t DET_UL_13;
|
182
|
|
- int8_t DET_UL_14;
|
183
|
|
- int8_t DET_UL_15;
|
184
|
|
- int8_t DET_UL_16;
|
185
|
|
- int8_t DET_UL_17;
|
186
|
|
- int8_t DET_UL_18;
|
187
|
|
- int8_t DET_UL_19;
|
188
|
|
- int8_t DET_UL_20;
|
189
|
|
- int8_t DET_UL_21;
|
190
|
|
- int8_t DET_UL_22;
|
191
|
|
- int8_t DET_UL_23;
|
192
|
|
- int8_t DET_UL_24;
|
193
|
|
- int8_t DET_UL_25;
|
194
|
|
- int8_t DET_UL_26;
|
195
|
|
- int8_t DET_UL_27;
|
196
|
|
- int8_t DET_UL_28;
|
197
|
|
- int8_t DET_UL_29;
|
198
|
|
- int8_t DET_UL_30;
|
199
|
|
- int8_t DET_UL_31;
|
200
|
|
- int8_t DET_UL_32;
|
201
|
|
- int8_t DET_UL_33;
|
202
|
|
- int8_t DET_UL_34;
|
203
|
|
- int8_t DET_UL_35;
|
204
|
|
- int8_t DET_UL_36;
|
205
|
|
- int8_t DET_UL_37;
|
206
|
|
- int8_t DET_UL_38;
|
207
|
|
- int8_t DET_UL_39;
|
208
|
|
- int8_t DET_UL_40;
|
209
|
|
- int8_t DET_UL_41;
|
210
|
|
- int8_t DET_UL_42;
|
211
|
|
- int8_t DET_UL_43;
|
212
|
|
- int8_t DET_UL_44;
|
213
|
|
- int8_t DET_UL_45;
|
214
|
|
-}ALC_dBm_t;
|
|
95
|
+
|
215
|
96
|
int8_t AGC_Table_ref[sizeof(AGC_dBm_t)] = {
|
216
|
97
|
5 , 4 , 3 , 2 ,
|
217
|
98
|
1 , 0 , -1 , -2 ,
|
|
@@ -256,13 +137,9 @@ ALC_dBm_t ALC_Table_ref = {
|
256
|
137
|
|
257
|
138
|
|
258
|
139
|
|
259
|
|
-double TableAtteGuarantee(uint8_t* Table,double AttenValue);
|
260
|
|
-uint8_t PE43711_Calc(uint8_t* Table,uint8_t high_bit,uint8_t low_bit,uint8_t offset_h,uint8_t offset_l);
|
261
|
|
-uint8_t PE43711_Calc_NoTable(uint8_t high_bit,uint8_t low_bit);
|
262
|
|
-double PE43711_Double(uint8_t high_bit,uint8_t low_bit);
|
263
|
|
-void Booting_LED_Check(void);
|
264
|
140
|
|
265
|
|
-int8_t AutoControl_Save[sizeof(ALC_dBm_t)];
|
|
141
|
+
|
|
142
|
+
|
266
|
143
|
|
267
|
144
|
uint8_t MBIC_TxDataArray[256] = {0,};
|
268
|
145
|
void Booting_LED_Check(void){
|
|
@@ -279,14 +156,7 @@ void Boot_LED_Toggle(void){
|
279
|
156
|
if(LedTimerCnt > 1000){
|
280
|
157
|
HAL_GPIO_TogglePin(BOOT_LED_GPIO_Port,BOOT_LED_Pin);
|
281
|
158
|
HAL_GPIO_TogglePin(LED_ACT_GPIO_Port,LED_ACT_Pin);
|
282
|
|
- if((bluecell_Currdatastatus.ALARM_TEMP_HIGH > 0
|
283
|
|
- || bluecell_Currdatastatus.ALARM_DLI_Level > 0
|
284
|
|
- || bluecell_Currdatastatus.ALARM_DLI_AGC_SHTUTDOWN > 0
|
285
|
|
- || bluecell_Currdatastatus.ALARM_DLI_AGC_Alarm > 0
|
286
|
|
- || bluecell_Currdatastatus.ALARM_ULO_ALC_Alarm > 0
|
287
|
|
- || bluecell_Currdatastatus.ALARM_ULO_Level > 0
|
288
|
|
- || bluecell_Currdatastatus.ALARM_ULO_ALC_SHTUTDOWN > 0)
|
289
|
|
- && bluecell_Currdatastatus.ALARM_MASK1 > 0){
|
|
159
|
+ if(AlarmTimerOnCnt > 3000){
|
290
|
160
|
HAL_GPIO_WritePin(LED_FAIL_GPIO_Port,LED_FAIL_Pin,GPIO_PIN_SET);
|
291
|
161
|
}else{
|
292
|
162
|
HAL_GPIO_WritePin(LED_FAIL_GPIO_Port,LED_FAIL_Pin,GPIO_PIN_RESET);
|
|
@@ -305,9 +175,9 @@ uint8_t PE43711_Calc(uint8_t* Table,uint8_t high_bit,uint8_t low_bit,uint8_t off
|
305
|
175
|
|
306
|
176
|
double ret = 0;
|
307
|
177
|
uint8_t Result = 0;
|
308
|
|
- ret = PE43711_Double(high_bit,low_bit);
|
309
|
|
- ret += PE43711_Double(offset_h,offset_l);
|
310
|
|
- ret += PE43711_Double(0,HIDDENATTEN);
|
|
178
|
+ ret = PE43711_Double(high_bit,low_bit); // Hidden Atten Calc
|
|
179
|
+ ret += PE43711_Double(offset_h,offset_l);//Plus User Atten Calc
|
|
180
|
+ ret += PE43711_Double(0,HIDDENATTEN);//Plus Default Atten 5
|
311
|
181
|
// printf("ret1 : %f \r\n",ret); // 2
|
312
|
182
|
ret = TableAtteGuarantee(Table,ret);//Table Guarantee
|
313
|
183
|
// printf("ret2 : %f \r\n",ret);
|
|
@@ -382,11 +252,11 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
|
382
|
252
|
bluecell_Prevdatastatus.ATT_DL1_L = bluecell_Currdatastatus.ATT_DL1_L;
|
383
|
253
|
bluecell_Prevdatastatus.bluecell_User_DL1_H = bluecell_Currdatastatus.bluecell_User_DL1_H;
|
384
|
254
|
bluecell_Prevdatastatus.bluecell_User_DL1_L = bluecell_Currdatastatus.bluecell_User_DL1_L;
|
385
|
|
- val = PE43711_Calc(&Att_DL1.Table_0_0_dBm,
|
386
|
|
- Curr.ATT_DL1_H,
|
387
|
|
- Curr.ATT_DL1_L,
|
388
|
|
- bluecell_Currdatastatus.bluecell_User_DL1_H,
|
389
|
|
- bluecell_Currdatastatus.bluecell_User_DL1_L);
|
|
255
|
+ val = PE43711_Calc(&Att_DL1.Table_0_0_dBm, // Table Offset
|
|
256
|
+ Curr.ATT_DL1_H, // Hidden Atten High bit
|
|
257
|
+ Curr.ATT_DL1_L, // Hidden Atten Low bit
|
|
258
|
+ bluecell_Currdatastatus.bluecell_User_DL1_H, // User Atten High Bit
|
|
259
|
+ bluecell_Currdatastatus.bluecell_User_DL1_L);// User Atten Low Bit
|
390
|
260
|
// printf("%s : %d \r\n",__func__,__LINE__);
|
391
|
261
|
// printf("%d val = %x \r\n",__LINE__,val);
|
392
|
262
|
PE43711_atten_ctrl(ALL_ATT.ATT_DL1,val);
|
|
@@ -400,11 +270,11 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
|
400
|
270
|
bluecell_Prevdatastatus.ATT_DL2_L = bluecell_Currdatastatus.ATT_DL2_L;
|
401
|
271
|
bluecell_Prevdatastatus.bluecell_User_DL2_H = bluecell_Currdatastatus.bluecell_User_DL2_H;
|
402
|
272
|
bluecell_Prevdatastatus.bluecell_User_DL2_L = bluecell_Currdatastatus.bluecell_User_DL2_L;
|
403
|
|
- val = PE43711_Calc(&Att_DL2.Table_0_0_dBm,
|
404
|
|
- Curr.ATT_DL2_H,
|
405
|
|
- Curr.ATT_DL2_L,
|
406
|
|
- bluecell_Currdatastatus.bluecell_User_DL2_H,
|
407
|
|
- bluecell_Currdatastatus.bluecell_User_DL2_L);
|
|
273
|
+ val = PE43711_Calc(&Att_DL2.Table_0_0_dBm,// Table Offset
|
|
274
|
+ Curr.ATT_DL2_H,// Hidden Atten High bit
|
|
275
|
+ Curr.ATT_DL2_L,// Hidden Atten Low bit
|
|
276
|
+ bluecell_Currdatastatus.bluecell_User_DL2_H,// User Atten High Bit
|
|
277
|
+ bluecell_Currdatastatus.bluecell_User_DL2_L);// User Atten Low Bit
|
408
|
278
|
// printf("%d val = %x \r\n",__LINE__,val);
|
409
|
279
|
PE43711_atten_ctrl(ALL_ATT.ATT_DL2,val);
|
410
|
280
|
}
|
|
@@ -418,11 +288,11 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
|
418
|
288
|
bluecell_Prevdatastatus.ATT_DL3_L = bluecell_Currdatastatus.ATT_DL3_L;
|
419
|
289
|
bluecell_Prevdatastatus.bluecell_User_DL3_H = bluecell_Currdatastatus.bluecell_User_DL3_H;
|
420
|
290
|
bluecell_Prevdatastatus.bluecell_User_DL3_L = bluecell_Currdatastatus.bluecell_User_DL3_L;
|
421
|
|
- val = PE43711_Calc(&Att_DL3.Table_0_0_dBm,
|
422
|
|
- Curr.ATT_DL3_H,
|
423
|
|
- Curr.ATT_DL3_L,
|
424
|
|
- bluecell_Currdatastatus.bluecell_User_DL3_H,
|
425
|
|
- bluecell_Currdatastatus.bluecell_User_DL3_L);
|
|
291
|
+ val = PE43711_Calc(&Att_DL3.Table_0_0_dBm,// Table Offset
|
|
292
|
+ Curr.ATT_DL3_H,// Hidden Atten High bit
|
|
293
|
+ Curr.ATT_DL3_L,// Hidden Atten Low bit
|
|
294
|
+ bluecell_Currdatastatus.bluecell_User_DL3_H,// User Atten High Bit
|
|
295
|
+ bluecell_Currdatastatus.bluecell_User_DL3_L);// User Atten Low Bit
|
426
|
296
|
// printf("%d val = %x \r\n",__LINE__,val);
|
427
|
297
|
PE43711_atten_ctrl(ALL_ATT.ATT_DL3,val);
|
428
|
298
|
}
|
|
@@ -438,11 +308,11 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
|
438
|
308
|
bluecell_Prevdatastatus.ATT_DL4_L = bluecell_Currdatastatus.ATT_DL4_L;
|
439
|
309
|
bluecell_Prevdatastatus.bluecell_User_DL4_H = bluecell_Currdatastatus.bluecell_User_DL4_H;
|
440
|
310
|
bluecell_Prevdatastatus.bluecell_User_DL4_L = bluecell_Currdatastatus.bluecell_User_DL4_L;
|
441
|
|
- val = PE43711_Calc(&Att_DL4.Table_0_0_dBm,
|
442
|
|
- Curr.ATT_DL4_H,
|
443
|
|
- Curr.ATT_DL4_L,
|
444
|
|
- bluecell_Currdatastatus.bluecell_User_DL4_H,
|
445
|
|
- bluecell_Currdatastatus.bluecell_User_DL4_L);
|
|
311
|
+ val = PE43711_Calc(&Att_DL4.Table_0_0_dBm,// Table Offset
|
|
312
|
+ Curr.ATT_DL4_H,// Hidden Atten High bit
|
|
313
|
+ Curr.ATT_DL4_L,// Hidden Atten Low bit
|
|
314
|
+ bluecell_Currdatastatus.bluecell_User_DL4_H,// User Atten High Bit
|
|
315
|
+ bluecell_Currdatastatus.bluecell_User_DL4_L);// User Atten Low Bit
|
446
|
316
|
// printf("%d val = %x \r\n",__LINE__,val);
|
447
|
317
|
PE43711_atten_ctrl(ALL_ATT.ATT_DL4,val);
|
448
|
318
|
}
|
|
@@ -457,11 +327,11 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
|
457
|
327
|
bluecell_Prevdatastatus.ATT_UL1_L = bluecell_Currdatastatus.ATT_UL1_L;
|
458
|
328
|
bluecell_Prevdatastatus.bluecell_User_UL1_H = bluecell_Currdatastatus.bluecell_User_UL1_H;
|
459
|
329
|
bluecell_Prevdatastatus.bluecell_User_UL1_L = bluecell_Currdatastatus.bluecell_User_UL1_L;
|
460
|
|
- val = PE43711_Calc(&Att_UL1.Table_0_0_dBm,
|
461
|
|
- Curr.ATT_UL1_H,
|
462
|
|
- Curr.ATT_UL1_L,
|
463
|
|
- bluecell_Currdatastatus.bluecell_User_UL1_H,
|
464
|
|
- bluecell_Currdatastatus.bluecell_User_UL1_L);
|
|
330
|
+ val = PE43711_Calc(&Att_UL1.Table_0_0_dBm,// Table Offset
|
|
331
|
+ Curr.ATT_UL1_H,// Hidden Atten High bit
|
|
332
|
+ Curr.ATT_UL1_L,// Hidden Atten Low bit
|
|
333
|
+ bluecell_Currdatastatus.bluecell_User_UL1_H,// User Atten High Bit
|
|
334
|
+ bluecell_Currdatastatus.bluecell_User_UL1_L);// User Atten Low Bit
|
465
|
335
|
// printf("%d val = %x \r\n",__LINE__,val);
|
466
|
336
|
PE43711_atten_ctrl(ALL_ATT.ATT_UL1,val);
|
467
|
337
|
}
|
|
@@ -473,11 +343,11 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
|
473
|
343
|
bluecell_Prevdatastatus.ATT_UL2_L = bluecell_Currdatastatus.ATT_UL2_L;
|
474
|
344
|
bluecell_Prevdatastatus.bluecell_User_UL2_H = bluecell_Currdatastatus.bluecell_User_UL2_H;
|
475
|
345
|
bluecell_Prevdatastatus.bluecell_User_UL2_L = bluecell_Currdatastatus.bluecell_User_UL2_L;
|
476
|
|
- val = PE43711_Calc(&Att_UL2.Table_0_0_dBm,
|
477
|
|
- Curr.ATT_UL2_H,
|
478
|
|
- Curr.ATT_UL2_L,
|
479
|
|
- bluecell_Currdatastatus.bluecell_User_UL2_H,
|
480
|
|
- bluecell_Currdatastatus.bluecell_User_UL2_L);
|
|
346
|
+ val = PE43711_Calc(&Att_UL2.Table_0_0_dBm,// Table Offset
|
|
347
|
+ Curr.ATT_UL2_H,// Hidden Atten High bit
|
|
348
|
+ Curr.ATT_UL2_L,// Hidden Atten Low bit
|
|
349
|
+ bluecell_Currdatastatus.bluecell_User_UL2_H,// User Atten High Bit
|
|
350
|
+ bluecell_Currdatastatus.bluecell_User_UL2_L);// User Atten Low Bit
|
481
|
351
|
// printf("%d val = %x \r\n",__LINE__,val);
|
482
|
352
|
PE43711_atten_ctrl(ALL_ATT.ATT_UL2,val);
|
483
|
353
|
}
|
|
@@ -492,11 +362,11 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
|
492
|
362
|
bluecell_Prevdatastatus.bluecell_User_UL3_H = bluecell_Currdatastatus.bluecell_User_UL3_H;
|
493
|
363
|
bluecell_Prevdatastatus.bluecell_User_UL3_L = bluecell_Currdatastatus.bluecell_User_UL3_L;
|
494
|
364
|
|
495
|
|
- val = PE43711_Calc(&Att_UL3.Table_0_0_dBm,
|
496
|
|
- Curr.ATT_UL3_H,
|
497
|
|
- Curr.ATT_UL3_L,
|
498
|
|
- bluecell_Currdatastatus.bluecell_User_UL3_H,
|
499
|
|
- bluecell_Currdatastatus.bluecell_User_UL3_L);
|
|
365
|
+ val = PE43711_Calc(&Att_UL3.Table_0_0_dBm,// Table Offset
|
|
366
|
+ Curr.ATT_UL3_H,// Hidden Atten High bit
|
|
367
|
+ Curr.ATT_UL3_L,// Hidden Atten Low bit
|
|
368
|
+ bluecell_Currdatastatus.bluecell_User_UL3_H,// User Atten High Bit
|
|
369
|
+ bluecell_Currdatastatus.bluecell_User_UL3_L);// User Atten Low Bit
|
500
|
370
|
// printf("%d val = %x \r\n",__LINE__,val);
|
501
|
371
|
PE43711_atten_ctrl(ALL_ATT.ATT_UL3,val);
|
502
|
372
|
}
|
|
@@ -509,40 +379,40 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
|
509
|
379
|
bluecell_Prevdatastatus.bluecell_User_UL4_H = bluecell_Currdatastatus.bluecell_User_UL4_H;
|
510
|
380
|
bluecell_Prevdatastatus.bluecell_User_UL4_L = bluecell_Currdatastatus.bluecell_User_UL4_L;
|
511
|
381
|
|
512
|
|
- val = PE43711_Calc(&Att_UL4.Table_0_0_dBm,
|
513
|
|
- Curr.ATT_UL4_H,
|
514
|
|
- Curr.ATT_UL4_L,
|
515
|
|
- bluecell_Currdatastatus.bluecell_User_UL4_H,
|
516
|
|
- bluecell_Currdatastatus.bluecell_User_UL4_L);
|
|
382
|
+ val = PE43711_Calc(&Att_UL4.Table_0_0_dBm,// Table Offset
|
|
383
|
+ Curr.ATT_UL4_H,// Hidden Atten High bit
|
|
384
|
+ Curr.ATT_UL4_L,// Hidden Atten Low bit
|
|
385
|
+ bluecell_Currdatastatus.bluecell_User_UL4_H,// User Atten High Bit
|
|
386
|
+ bluecell_Currdatastatus.bluecell_User_UL4_L);// User Atten Low Bit
|
517
|
387
|
// printf("%d val = %x \r\n",__LINE__,val);
|
518
|
388
|
PE43711_atten_ctrl(ALL_ATT.ATT_UL4,val);
|
519
|
389
|
}
|
520
|
390
|
// memcpy(&bluecell_Prevdatastatus.ATT_DL1_H,&bluecell_Currdatastatus.ATT_DL1_H,32);
|
521
|
|
-#if 1 // PYJ.2020.04.21_BEGIN --
|
|
391
|
+#if 0 // PYJ.2020.04.21_BEGIN --
|
522
|
392
|
|
523
|
|
- if((Curr.ATT_ALC1_MAX_H != Prev.ATT_ALC1_MAX_H
|
524
|
|
- ||Curr.ATT_ALC1_MAX_L != Prev.ATT_ALC1_MAX_L)
|
|
393
|
+ if((Curr.ATT_ALC_Threshold_H != Prev.ATT_ALC_Threshold_H
|
|
394
|
+ ||Curr.ATT_ALC_Threshold_L != Prev.ATT_ALC_Threshold_L)
|
525
|
395
|
||(Curr.bluecell_User_UL1_H != Prev.bluecell_User_UL1_H
|
526
|
396
|
||Curr.bluecell_User_UL1_L != Prev.bluecell_User_UL1_L)){
|
527
|
|
- bluecell_Prevdatastatus.ATT_ALC1_MAX_H = bluecell_Currdatastatus.ATT_ALC1_MAX_H;
|
528
|
|
- bluecell_Prevdatastatus.ATT_ALC1_MAX_L = bluecell_Currdatastatus.ATT_ALC1_MAX_L;
|
|
397
|
+ bluecell_Prevdatastatus.ATT_ALC_Threshold_H = bluecell_Currdatastatus.ATT_ALC_Threshold_H;
|
|
398
|
+ bluecell_Prevdatastatus.ATT_ALC_Threshold_L = bluecell_Currdatastatus.ATT_ALC_Threshold_L;
|
529
|
399
|
bluecell_Prevdatastatus.bluecell_User_UL1_H = bluecell_Currdatastatus.bluecell_User_UL1_H;
|
530
|
400
|
bluecell_Prevdatastatus.bluecell_User_UL1_L = bluecell_Currdatastatus.bluecell_User_UL1_L;
|
531
|
401
|
val = PE43711_Calc(&Att_UL1.Table_0_0_dBm,
|
532
|
|
- Curr.ATT_ALC1_MAX_H,
|
533
|
|
- Curr.ATT_ALC1_MAX_L,
|
|
402
|
+ Curr.ATT_ALC_Threshold_H,
|
|
403
|
+ Curr.ATT_ALC_Threshold_L,
|
534
|
404
|
bluecell_Currdatastatus.bluecell_User_DL1_H,
|
535
|
405
|
bluecell_Currdatastatus.bluecell_User_DL1_L);
|
536
|
406
|
// val = PE43711_DataToHexConvert(ret);
|
537
|
407
|
// PE43711_atten_ctrl(ALL_ATT.ATT_DL1,val);
|
538
|
408
|
|
539
|
409
|
}
|
540
|
|
- if((Curr.ATT_ALC2_MAX_H != Prev.ATT_ALC2_MAX_H
|
541
|
|
- ||Curr.ATT_ALC2_MAX_L != Prev.ATT_ALC2_MAX_L)
|
|
410
|
+ if((Curr.ATT_ALC_Threshold_H != Prev.ATT_ALC_Threshold_H
|
|
411
|
+ ||Curr.ATT_ALC_Threshold_L != Prev.ATT_ALC_Threshold_L)
|
542
|
412
|
||(Curr.bluecell_User_UL2_H != Prev.bluecell_User_UL2_H
|
543
|
413
|
||Curr.bluecell_User_UL2_L != Prev.bluecell_User_UL2_L)){
|
544
|
|
- bluecell_Prevdatastatus.ATT_ALC2_MAX_H = bluecell_Currdatastatus.ATT_ALC2_MAX_H;
|
545
|
|
- bluecell_Prevdatastatus.ATT_ALC2_MAX_L = bluecell_Currdatastatus.ATT_ALC2_MAX_L;
|
|
414
|
+ bluecell_Prevdatastatus.ATT_ALC_Threshold_H = bluecell_Currdatastatus.ATT_ALC_Threshold_H;
|
|
415
|
+ bluecell_Prevdatastatus.ATT_ALC_Threshold_L = bluecell_Currdatastatus.ATT_ALC_Threshold_L;
|
546
|
416
|
bluecell_Prevdatastatus.bluecell_User_UL2_H = bluecell_Currdatastatus.bluecell_User_UL2_H;
|
547
|
417
|
bluecell_Prevdatastatus.bluecell_User_UL2_L = bluecell_Currdatastatus.bluecell_User_UL2_L;
|
548
|
418
|
val = PE43711_Calc(&Att_UL2.Table_0_0_dBm,
|
|
@@ -554,12 +424,12 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
|
554
|
424
|
// PE43711_atten_ctrl(ALL_ATT.ATT_DL1,val);
|
555
|
425
|
|
556
|
426
|
}
|
557
|
|
- if((Curr.ATT_ALC3_MAX_H != Prev.ATT_ALC3_MAX_H
|
558
|
|
- ||Curr.ATT_ALC3_MAX_L != Prev.ATT_ALC3_MAX_L)
|
|
427
|
+ if((Curr.ATT_ALC_Threshold_H != Prev.ATT_ALC_Threshold_H
|
|
428
|
+ ||Curr.ATT_ALC_Threshold_L != Prev.ATT_ALC_Threshold_L)
|
559
|
429
|
||(Curr.bluecell_User_UL3_H != Prev.bluecell_User_UL3_H
|
560
|
430
|
||Curr.bluecell_User_UL3_L != Prev.bluecell_User_UL3_L)){
|
561
|
|
- bluecell_Prevdatastatus.ATT_ALC3_MAX_H = bluecell_Currdatastatus.ATT_ALC3_MAX_H;
|
562
|
|
- bluecell_Prevdatastatus.ATT_ALC3_MAX_L = bluecell_Currdatastatus.ATT_ALC3_MAX_L;
|
|
431
|
+ bluecell_Prevdatastatus.ATT_ALC_Threshold_H = bluecell_Currdatastatus.ATT_ALC_Threshold_H;
|
|
432
|
+ bluecell_Prevdatastatus.ATT_ALC_Threshold_L = bluecell_Currdatastatus.ATT_ALC_Threshold_L;
|
563
|
433
|
bluecell_Prevdatastatus.bluecell_User_UL3_H = bluecell_Currdatastatus.bluecell_User_UL3_H;
|
564
|
434
|
bluecell_Prevdatastatus.bluecell_User_UL3_L = bluecell_Currdatastatus.bluecell_User_UL3_L;
|
565
|
435
|
val = PE43711_Calc(&Att_UL3.Table_0_0_dBm,
|
|
@@ -571,13 +441,13 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
|
571
|
441
|
// PE43711_atten_ctrl(ALL_ATT.ATT_DL1,val);
|
572
|
442
|
|
573
|
443
|
}
|
574
|
|
- if((Curr.ATT_ALC4_MAX_H != Prev.ATT_ALC4_MAX_H
|
575
|
|
- ||Curr.ATT_ALC4_MAX_L != Prev.ATT_ALC4_MAX_L)
|
|
444
|
+ if((Curr.ATT_ALC_Threshold_H != Prev.ATT_ALC_Threshold_H
|
|
445
|
+ ||Curr.ATT_ALC_Threshold_L != Prev.ATT_ALC_Threshold_L)
|
576
|
446
|
||(Curr.bluecell_User_UL4_H != Prev.bluecell_User_UL4_H
|
577
|
447
|
||Curr.bluecell_User_UL4_L != Prev.bluecell_User_UL4_L)){
|
578
|
448
|
// printf("Curr.ATT_ALC4_MAX_H : %x Curr.ATT_ALC4_MAX_L : %x\r\n",Curr.ATT_ALC4_MAX_H,Curr.ATT_ALC4_MAX_L);
|
579
|
|
- bluecell_Prevdatastatus.ATT_ALC4_MAX_H = bluecell_Currdatastatus.ATT_ALC4_MAX_H;
|
580
|
|
- bluecell_Prevdatastatus.ATT_ALC4_MAX_L = bluecell_Currdatastatus.ATT_ALC4_MAX_L;
|
|
449
|
+ bluecell_Prevdatastatus.ATT_ALC_Threshold_H = bluecell_Currdatastatus.ATT_ALC_Threshold_H;
|
|
450
|
+ bluecell_Prevdatastatus.ATT_ALC_Threshold_L = bluecell_Currdatastatus.ATT_ALC_Threshold_L;
|
581
|
451
|
bluecell_Prevdatastatus.bluecell_User_UL4_H = bluecell_Currdatastatus.bluecell_User_UL4_H;
|
582
|
452
|
bluecell_Prevdatastatus.bluecell_User_UL4_L = bluecell_Currdatastatus.bluecell_User_UL4_L;
|
583
|
453
|
val = PE43711_Calc(&Att_UL4.Table_0_0_dBm,
|
|
@@ -685,10 +555,7 @@ uint16_t ConvertTo2byte(uint8_t highbit, uint8_t lowbit){
|
685
|
555
|
|
686
|
556
|
return ret;
|
687
|
557
|
}
|
688
|
|
-typedef struct{
|
689
|
|
- uint8_t High_bit;
|
690
|
|
- uint8_t Low_bit;
|
691
|
|
-}OneByteToTwoByte;
|
|
558
|
+
|
692
|
559
|
OneByteToTwoByte ConvertTo1Byte(uint16_t data){
|
693
|
560
|
OneByteToTwoByte ret;
|
694
|
561
|
|
|
@@ -971,10 +838,6 @@ void Bluecell_TableSave(uint8_t* data,uint8_t type){
|
971
|
838
|
}
|
972
|
839
|
|
973
|
840
|
}
|
974
|
|
-uint8_t Txdata[512];
|
975
|
|
-extern HAL_StatusTypeDef EEPROM_M24C08_Zerowrite(uint8_t devid,uint16_t Address);
|
976
|
|
-
|
977
|
|
-
|
978
|
841
|
|
979
|
842
|
|
980
|
843
|
|
|
@@ -1067,7 +930,6 @@ bool Bluecell_Operate(uint8_t* data){
|
1067
|
930
|
Atten Ctrl Function
|
1068
|
931
|
*/
|
1069
|
932
|
CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
1070
|
|
- break;
|
1071
|
933
|
// printf("ret : %f ,tmp %f \r\n",ret,tmp );
|
1072
|
934
|
break;
|
1073
|
935
|
case ATT_DL1_PATH :
|
|
@@ -1692,12 +1554,7 @@ void ALARM_Value_Get(uint8_t datatype,uint8_t* ret){
|
1692
|
1554
|
|
1693
|
1555
|
}
|
1694
|
1556
|
|
1695
|
|
-typedef enum{
|
1696
|
|
- MBIC_GET = 0,
|
1697
|
|
- MBIC_SET,
|
1698
|
|
- MBIC_Table_Get = 0x40,
|
1699
|
|
- MBIC_Table_Set = 0x41,
|
1700
|
|
-}BMBM_CMD;
|
|
1557
|
+
|
1701
|
1558
|
|
1702
|
1559
|
bool MBIC_Operate(uint8_t* data){
|
1703
|
1560
|
uint16_t datatype = (((data[MBIC_PROT_SUB_DATA_INDEX] << 8) & 0xFF00) // 2byte Data
|
|
@@ -2616,14 +2473,6 @@ uint32_t SumFunc(uint16_t* data,uint16_t size){
|
2616
|
2473
|
return ret;
|
2617
|
2474
|
}
|
2618
|
2475
|
|
2619
|
|
-extern volatile uint32_t ADC1_Average_value[4];
|
2620
|
|
-extern volatile uint32_t ADC3_Average_value[5];
|
2621
|
|
-extern volatile uint16_t ADC1valuearray[4][ADC_AVERAGECNT];
|
2622
|
|
-extern volatile uint16_t ADC3valuearray[5][ADC_AVERAGECNT];
|
2623
|
|
-
|
2624
|
|
-uint16_t ADC1Ret[4];
|
2625
|
|
-uint16_t ADC3Ret[5];
|
2626
|
|
-
|
2627
|
2476
|
void ADC_Check(void){
|
2628
|
2477
|
//static uint8_t Cnt = 0;
|
2629
|
2478
|
|
|
@@ -3231,9 +3080,13 @@ void Alarm_Check(){
|
3231
|
3080
|
|| bluecell_Currdatastatus.ALARM_ULO_ALC_Alarm > 0
|
3232
|
3081
|
|| bluecell_Currdatastatus.ALARM_ULO_Level > 0
|
3233
|
3082
|
|| bluecell_Currdatastatus.ALARM_ULO_ALC_SHTUTDOWN > 0){
|
3234
|
|
- AlarmTimerSet = true;
|
|
3083
|
+ AlarmTimerOnSet = true;
|
|
3084
|
+ AlarmTimerOffSet = false;
|
3235
|
3085
|
}else{
|
3236
|
|
- AlarmTimerSet = false;
|
|
3086
|
+ AlarmTimerOffSet = true;// False
|
|
3087
|
+ if(AlarmTimerOffCnt > 10000){
|
|
3088
|
+ AlarmTimerOnSet = false;
|
|
3089
|
+ }
|
3237
|
3090
|
}
|
3238
|
3091
|
|
3239
|
3092
|
/******************************TEMP START*******************************************/
|
|
@@ -3247,8 +3100,8 @@ void Alarm_Check(){
|
3247
|
3100
|
/******************************TEMP END*******************************************/
|
3248
|
3101
|
|
3249
|
3102
|
/******************************ULO LEVEL START*******************************************/
|
3250
|
|
-
|
3251
|
|
- if(bluecell_Currdatastatus.ULO_ALC_ON_OFF == true){
|
|
3103
|
+
|
|
3104
|
+ if(bluecell_Currdatastatus.ULO_ALC_ON_OFF == true){ // ALC ON
|
3252
|
3105
|
temp = ((bluecell_Currdatastatus.ULO_Level_High_Threshold_H << 8) & 0xFF00);
|
3253
|
3106
|
temp += (bluecell_Currdatastatus.ULO_Level_High_Threshold_L & 0x00FF);
|
3254
|
3107
|
|