Telltales_user.c 12.7 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 75
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                        },
    {em_LED_S,                    SelfCheck,     NoExterNalCheck,        LED_IGN_ON,             0u,         3000ul,         LED_S_Judgement,                    LED_S_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;
}
76 77 78 79 80



/*硬线-P10 高电平点亮*/
static Tellib_uint16_t LED_Turn_Left_Judgement(void)
81 82 83 84 85 86 87 88 89 90 91 92 93 94
{
    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)
{
95
   
96
}
97

98 99

/*硬线-P9 高电平点亮*/
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
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)
{
115
   
116
}
117 118 119


/*硬线-P18 高电平点亮*/
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
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)
{
135
   
136
}
137 138

/*硬线-P15 低电平点亮*/
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
static Tellib_uint16_t LED_Efi_Fault_Judgement(void)
{
    Tellib_uint16_t LED_STATE = 0u;
    if (Line_In_Get_Status(LINE_IN_Efi_Fault))
    {
        LED_STATE = 1;
    }
    else
    {
        LED_STATE = 0;
    }
    return LED_STATE;
}
static void LED_Efi_Fault_Execution(Tellib_uint16_t led_status)
{
154
   
155
}
156 157


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

175
}
176

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


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


217 218 219
/*CAN信号来源:TCS_37B*/
static Tellib_uint16_t LED_TCS_Judgement(void)
{
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
    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
    {
       if(Get_CAN_CH0_ID_37B_Sig_TCS_Warning_Lamp() == 1)
       {
           LED_STATE = 1u;
       }
       else
       {
           LED_STATE = 0u;
       }
    }
    return LED_STATE;
237 238 239
}
static void LED_TCS_Execution(Tellib_uint16_t led_status)
{
240
   
241
}
242 243


244 245 246
/*信号来源:ISG_111*/
static Tellib_uint16_t LED_HEV_Judgement(void)
{
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
    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_Ready() == 0x01UL)
      {
          LED_STATE = 1u;
      }
      else
      {
          LED_STATE = 0u;
      }
    }
    return LED_STATE;
264 265 266
}
static void LED_HEV_Execution(Tellib_uint16_t led_status)
{
267
   
268
}
269 270


271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
/*硬线-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)
{
287
  
288
}
289 290


291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
/*硬线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)
{
307 308 309 310
   
}


311 312 313
/*信号来源:ECU_101 +硬线-P11 阻值 CAN>硬线*/
static Tellib_uint16_t LED_Coolant_Temperature_Judgement(void)
{
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
    Tellib_uint16_t LED_STATE = 0u;
    if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CH0_101_Msg_Count) == CAN_SIG_LOST)
    {
       LED_STATE = 0u;
    }
    else
    {
        if(Get_CAN_CH0_ID_101_Sig_ECU_Engine_Temperature_State() == 0x01UL)
        {
          LED_STATE = 1u;
        }
        else
        {
            if(Line_In_Get_Status(LINE_IN_Voltage))
            {
                LED_STATE = 1u;
            }
            else
            {
                LED_STATE = 0u;
            } 
        }
    }
    return LED_STATE;
338 339 340
}
static void LED_Coolant_Temperature_Execution(Tellib_uint16_t led_status)
{
341
  
342
}
343 344


345 346 347
/*无*/
static Tellib_uint16_t LED_WIFI_Judgement(void)
{
348
    Tellib_uint16_t LED_STATE = 0u;/*设置为常灭*/
349 350 351 352
    return LED_STATE;
}
static void LED_WIFI_Execution(Tellib_uint16_t led_status)
{
353
 
354
}
355

356 357 358
/*信号来源:蓝牙模块*/
static Tellib_uint16_t LED_Bluetooth_Judgement(void)
{
359 360
    Tellib_uint16_t LED_STATE = 0u;
    return LED_STATE;
361 362 363
}
static void LED_Bluetooth_Execution(Tellib_uint16_t led_status)
{
364
   
365
}
366

367 368 369
/*信号来源:0x111*/
static Tellib_uint16_t LED_E_Judgement(void)
{
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393
    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)
        {
            if(Get_CAN_CH0_ID_111_Sig_ISG_Power_Enable() == 1)
            {
                LED_STATE = 1u;
            }
            else
            {
                LED_STATE = 0u;
            }
        }
        else
        {
            LED_STATE = 0u;
        }
    }
    return LED_STATE;
394 395 396
}
static void LED_E_Execution(Tellib_uint16_t led_status)
{
397
   
398
}
399

400 401 402
/*信号来源:0x111*/
static Tellib_uint16_t LED_S_Judgement(void)
{
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
    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)
        {
            if(Get_CAN_CH0_ID_111_Sig_ISG_Power_Enable() == 0x2UL)
            {
                LED_STATE = 1u;
            }
            else
            {
                LED_STATE = 0u;
            }
        }
        else
        {
            LED_STATE = 0u;
        }
    }
    return LED_STATE;
427 428 429
}
static void LED_S_Execution(Tellib_uint16_t led_status)
{
430
  
431
}