Telltales_user.c 12.8 KB
Newer Older
时昊's avatar
时昊 committed
1 2


3 4 5 6
#include "Telltales_Lib.h"
#include "Telltales_user.h"
#include "Line_In\Line_In_user.h"
#include "Components.h"
时昊's avatar
时昊 committed
7

8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
static Tellib_uint16_t LED_Turn_Left_Judgement(void);
static void            LED_Turn_Left_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_Turn_Right_Judgement(void);
static void            LED_Turn_Right_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_High_Beam_Judgement(void);
static void            LED_High_Beam_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_Efi_Fault_Judgement(void);//电喷故障灯
static void            LED_Efi_Fault_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_ABS_Judgement(void);
static void            LED_ABS_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_Auto_Start_Stop_Judgement(void);
static void            LED_Auto_Start_Stop_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_Oil_Pressure_Alert_Judgement(void);
static void            LED_Oil_Pressure_Alert_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_TCS_Judgement(void);
static void            LED_TCS_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_HEV_Judgement(void);
static void            LED_HEV_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_Voltage_Judgement(void);
static void            LED_Voltage_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_Fuel_Level_Low_Judgement(void);
static void            LED_Fuel_Level_Low_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_Coolant_Temperature_Judgement(void);
static void            LED_Coolant_Temperature_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_WIFI_Judgement(void);
static void            LED_WIFI_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_Bluetooth_Judgement(void);
static void            LED_Bluetooth_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_E_Judgement(void);
static void            LED_E_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_S_Judgement(void);
static void            LED_S_Execution(Tellib_uint16_t led_status);
uint8_t u8CanId401Flag = 0;
const LED_Attribute_st LED_Attribute [ LED_Max ] = {
    /*  指示灯索引                  是否自检          外部信号自检           工作电源状态       自检开始时间    自检持续时间       指示灯点亮条件                           指示灯执行函数               */
    
    {em_LED_Turn_Left,            SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_Turn_Left_Judgement,            LED_Turn_Left_Execution                },
    {em_LED_Turn_Right,           SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_Turn_Right_Judgement,           LED_Turn_Right_Execution               },
    {em_LED_High_Beam,            SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_High_Beam_Judgement,            LED_High_Beam_Execution                },
    {em_LED_Efi_Fault,            SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_Efi_Fault_Judgement,            LED_Efi_Fault_Execution                },    
    {em_LED_ABS,                  SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_ABS_Judgement,                  LED_ABS_Execution                      },
    {em_LED_Auto_Start_Stop,      SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_Auto_Start_Stop_Judgement,      LED_Auto_Start_Stop_Execution          },
    {em_LED_Oil_Pressure_Alert,   SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_Oil_Pressure_Alert_Judgement,   LED_Oil_Pressure_Alert_Execution       },
    {em_LED_TCS,                  SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_TCS_Judgement,                  LED_TCS_Execution                      },
    {em_LED_HEV,                  SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_HEV_Judgement,                  LED_HEV_Execution                      },
    {em_LED_Voltage,              SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_Voltage_Judgement,              LED_Voltage_Execution                  },
    {em_LED_Fuel_Level_Low,       SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_Fuel_Level_Low_Judgement,       LED_Fuel_Level_Low_Execution           },
    {em_LED_Coolant_Temperature,  SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_Coolant_Temperature_Judgement,  LED_Coolant_Temperature_Execution      },
    {em_LED_WIFI,                 SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_WIFI_Judgement,                 LED_WIFI_Execution                     },
    {em_LED_Bluetooth,            SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_Bluetooth_Judgement,            LED_Bluetooth_Execution                },
    {em_LED_E,                    SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_E_Judgement,                    LED_E_Execution                        },
};
Tellib_uint8_t Tel_Mem [ Tel_MEM_Block_Size * LED_Max + Tel_MEM_Block_Addition ];
 void Telltales_Init(void)
 {
    TelExtPara m_ExtPara;
    m_ExtPara.TotalLength           = LED_Max;
    m_ExtPara.LED_PowerOFF_TimerCbk = Common_GetIgnOffTime;
    m_ExtPara.LED_PowerON_TimerCbk  = Common_GetIgnOnTime;
    m_ExtPara.LED_PowerCbk          = Common_Get_IG_Sts;
    u8CanId401Flag = 0;
    Telltales_KL30_Wakeup_Init(Tel_Mem, LED_Attribute, &m_ExtPara);
 }
void Can_ID_401(uint8_t CopyData [])
{
    u8CanId401Flag = 1;
}
75 76 77 78 79



/*硬线-P10 高电平点亮*/
static Tellib_uint16_t LED_Turn_Left_Judgement(void)
80 81 82 83 84 85 86 87 88 89 90 91 92 93
{
    Tellib_uint16_t LED_STATE = 0u;
    if (Line_In_Get_Status(LINE_IN_Turn_Left))
    {
        LED_STATE = 1;
    }
    else
    {
        LED_STATE = 0;
    }
    return LED_STATE;
}
static void LED_Turn_Left_Execution(Tellib_uint16_t led_status)
{
94
   
95
}
96

97 98

/*硬线-P9 高电平点亮*/
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
static Tellib_uint16_t LED_Turn_Right_Judgement(void)
{
    Tellib_uint16_t LED_STATE = 0u;
    if (Line_In_Get_Status(LINE_IN_Turn_Right))
    {
        LED_STATE = 1;
    }
    else
    {
        LED_STATE = 0;
    }
    return LED_STATE;
}
static void LED_Turn_Right_Execution(Tellib_uint16_t led_status)
{
114
   
115
}
116 117 118


/*硬线-P18 高电平点亮*/
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
static Tellib_uint16_t LED_High_Beam_Judgement(void)
{
    Tellib_uint16_t LED_STATE = 0u;
    if (Line_In_Get_Status(LINE_IN_High_Beam))
    {
        LED_STATE = 1;
    }
    else
    {
        LED_STATE = 0;
    }
    return LED_STATE;
}
static void LED_High_Beam_Execution(Tellib_uint16_t led_status)
{
134
   
135
}
136

王雅楠's avatar
王雅楠 committed
137
uint8_t test =0;
138
/*硬线-P15 低电平点亮*/
139 140 141
static Tellib_uint16_t LED_Efi_Fault_Judgement(void)
{
    Tellib_uint16_t LED_STATE = 0u;
王雅楠's avatar
王雅楠 committed
142
    if (Line_In_Get_Status(LINE_IN_Efi_Fault))
143
    {
144
        LED_STATE = 1u;
王雅楠's avatar
王雅楠 committed
145
        test =1;
146 147 148
    }
    else
    {
149
        LED_STATE = 0u;
150
    }
王雅楠's avatar
王雅楠 committed
151

152 153 154 155
    return LED_STATE;
}
static void LED_Efi_Fault_Execution(Tellib_uint16_t led_status)
{
156
   
157
}
158 159


160 161 162 163
/*硬线-P7 悬空/高点亮 接地灭*/
static Tellib_uint16_t LED_ABS_Judgement(void)
{
    Tellib_uint16_t LED_STATE = 0u;
164
    if (Line_In_Get_Status(LINE_IN_ABS) == 0)
165
    {
166
        LED_STATE = 0;
167 168 169
    }
    else
    {
170
        LED_STATE = 1;
171 172 173 174 175
    }
    return LED_STATE;
}
static void LED_ABS_Execution(Tellib_uint16_t led_status)
{
176

177
}
178

179 180 181 182
/*硬线-P12 低电平*/
static Tellib_uint16_t LED_Auto_Start_Stop_Judgement(void)
{
    Tellib_uint16_t LED_STATE = 0u;
王雅楠's avatar
王雅楠 committed
183
    if (Line_In_Get_Status(LINE_IN_Auto_Start_Stop))
184
    {
王雅楠's avatar
王雅楠 committed
185
        LED_STATE = 1u;
186 187 188
    }
    else
    {
王雅楠's avatar
王雅楠 committed
189
        LED_STATE = 0u;
190 191 192 193 194
    }
    return LED_STATE;
}
static void LED_Auto_Start_Stop_Execution(Tellib_uint16_t led_status)
{
195
   
196
}
197 198 199


/*硬线-P21 低电平点亮*/
200 201 202
static Tellib_uint16_t LED_Oil_Pressure_Alert_Judgement(void)
{
    Tellib_uint16_t LED_STATE = 0u;
王雅楠's avatar
王雅楠 committed
203
    if (Line_In_Get_Status(LINE_IN_Oil_Pressure_Alert))
204 205 206 207 208 209 210 211 212 213 214
    {
        LED_STATE = 1;
    }
    else
    {
        LED_STATE = 0;
    }
    return LED_STATE;
}
static void LED_Oil_Pressure_Alert_Execution(Tellib_uint16_t led_status)
{
215
  
216
}
217

218 219 220 221
/*
*@name:TCS指示灯
*@return: 0-都不亮 1-TCS亮 2-TCS/亮 3-TCS闪烁 
*/
222 223
static Tellib_uint16_t LED_TCS_Judgement(void)
{
224 225 226 227 228 229 230
    Tellib_uint16_t LED_STATE = 0u;
    if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CH0_37B_Msg_Count) == CAN_SIG_LOST)
    {
       LED_STATE = 0u;
    }
    else
    {
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
        if(Get_CAN_CH0_ID_37B_Sig_TCS_Work_Mode == 0x0)
        {
            if(Get_CAN_CH0_ID_37B_Sig_TCS_Warning_Lamp() == 0x1)
            {
                LED_STATE = 1u;/*TCS灯亮*/
            }
            else
            {
                LED_STATE = 0u;/*都不亮*/
            }
        }
        else
        {
            if(Get_CAN_CH0_ID_37B_Sig_TCS_Warning_Lamp() == 0x1)
            {
                LED_STATE = 2u;/*TCS/亮*/
            }
            else
            {
                ;
            } 
        } 
253 254
    }
    return LED_STATE;
255 256 257
}
static void LED_TCS_Execution(Tellib_uint16_t led_status)
{
258
   
259
}
260 261


262 263 264
/*
*信号来源:ISG_111
*/
265 266
static Tellib_uint16_t LED_HEV_Judgement(void)
{
267 268 269 270 271 272 273
    Tellib_uint16_t LED_STATE = 0u;
    if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CH0_111_Msg_Count) == CAN_SIG_LOST)
    {
       LED_STATE = 0u;
    }
    else
    {
274 275 276 277 278 279 280 281 282 283 284 285
        if((Get_CAN_CH0_ID_111_Sig_ISG_Ready() == 0x01UL)||((Get_CAN_CH0_ID_111_Sig_ISG_Power() == 1u)&&(Get_CAN_CH0_ID_111_Sig_ISG_Power_Enable() == 0u)))
        {
            LED_STATE = 1u;
        }
        else if((Get_CAN_CH0_ID_111_Sig_ISG_Ready() == 0UL)||(Get_CAN_CH0_ID_111_Sig_ISG_Power() == 0u)||(Get_CAN_CH0_ID_111_Sig_ISG_Power_Enable() == 0u))
        {
            LED_STATE = 0u;
        }
        else
        {
            LED_STATE = 0u;
        }
286 287
    }
    return LED_STATE;
288 289 290
}
static void LED_HEV_Execution(Tellib_uint16_t led_status)
{
291
   ;
292
}
293 294


295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
/*硬线-P19 电压值*/
static Tellib_uint16_t LED_Voltage_Judgement(void)
{
    Tellib_uint16_t LED_STATE = 0u;
    if (Line_In_Get_Status(LINE_IN_Voltage))
    {
        LED_STATE = 1;
    }
    else
    {
        LED_STATE = 0;
    }
    return LED_STATE;
}
static void LED_Voltage_Execution(Tellib_uint16_t led_status)
{
311
  ;
312
}
313 314


315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330
/*硬线P14-阻值*/
static Tellib_uint16_t LED_Fuel_Level_Low_Judgement(void)
{
    Tellib_uint16_t LED_STATE = 0u;
    if (Line_In_Get_Status(LINE_IN_Fuel_Level_Low))
    {
        LED_STATE = 1;
    }
    else
    {
        LED_STATE = 0;
    }
    return LED_STATE;
}
static void LED_Fuel_Level_Low_Execution(Tellib_uint16_t led_status)
{
331 332 333 334
   
}


335 336 337
/*信号来源:ECU_101 +硬线-P11 阻值 CAN>硬线*/
static Tellib_uint16_t LED_Coolant_Temperature_Judgement(void)
{
338 339 340
    Tellib_uint16_t LED_STATE = 0u;
    if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CH0_101_Msg_Count) == CAN_SIG_LOST)
    {
341 342 343 344 345 346 347 348 349
        LED_STATE = 0u;
        if(Line_In_Get_Status(LINE_IN_Coolant_Temperature))
        {
            LED_STATE = 1u;
        }
        else
        {
            LED_STATE = 0u;
        }
350 351 352 353 354 355 356 357 358
    }
    else
    {
        if(Get_CAN_CH0_ID_101_Sig_ECU_Engine_Temperature_State() == 0x01UL)
        {
          LED_STATE = 1u;
        }
        else
        {
359
            LED_STATE = 0u;
360 361 362
        }
    }
    return LED_STATE;
363 364 365
}
static void LED_Coolant_Temperature_Execution(Tellib_uint16_t led_status)
{
366
  
367
}
368 369


370
/*wifi*/
371 372
static Tellib_uint16_t LED_WIFI_Judgement(void)
{
373
    Tellib_uint16_t LED_STATE = 0u;/*设置为常灭*/
374 375 376 377
    return LED_STATE;
}
static void LED_WIFI_Execution(Tellib_uint16_t led_status)
{
378
    ;
379
}
380

381
/*bluetooth*/
382 383
static Tellib_uint16_t LED_Bluetooth_Judgement(void)
{
384 385
    Tellib_uint16_t LED_STATE = 0u;
    return LED_STATE;
386 387 388
}
static void LED_Bluetooth_Execution(Tellib_uint16_t led_status)
{
389
   ;
390
}
391

392 393 394 395 396 397

/*
* E S指示灯
*信号来源:0x111
* 0-都不亮  1-E亮 2-S亮
*/
398 399
static Tellib_uint16_t LED_E_Judgement(void)
{
400 401 402 403 404 405 406 407 408
    Tellib_uint16_t LED_STATE = 0u;
    if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CH0_111_Msg_Count) == CAN_SIG_LOST)
    {
       LED_STATE = 0u;
    }
    else
    {
        if(Get_CAN_CH0_ID_111_Sig_ISG_Power() == 0x01UL)
        {
409
            if(Get_CAN_CH0_ID_111_Sig_ISG_Power_Enable() == 1u)
410 411 412
            {
                LED_STATE = 1u;
            }
413 414 415 416
            else if(Get_CAN_CH0_ID_111_Sig_ISG_Power_Enable() == 2u)
            {
                LED_STATE = 2u;
            }
417 418 419 420 421 422 423 424 425 426 427
            else
            {
                LED_STATE = 0u;
            }
        }
        else
        {
            LED_STATE = 0u;
        }
    }
    return LED_STATE;
428 429 430
}
static void LED_E_Execution(Tellib_uint16_t led_status)
{
431
   ;
432
}
433