Line_In_user.c 2.91 KB
Newer Older
时昊's avatar
时昊 committed
1 2 3 4 5 6 7

#include "Line_In_user.h"
#include "Components.h"


const Line_In_Attribute_st g_stLineInAttribute[LINE_IN_MAX] =
{
8 9 10 11 12 13 14 15
    {LEVEL_LOW,   LEVEL_HIGH,    LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_Turn_Left,        },/*P10*/
    {LEVEL_LOW,   LEVEL_HIGH,    LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_Turn_Right,       },/*P9*/
    {LEVEL_LOW,   LEVEL_HIGH,    LINE_IN_IG_ON,     60U,  20U,  Get_LINE_IN_High_Beam,        },/*P18*/
    {LEVEL_HIGH,  LEVEL_LOW,     LINE_IN_IG_ON,     100U, 20U,  Get_LINE_IN_Efi_Fault,          },/*P15*/
    {LEVEL_LOW,    LEVEL_HIGH,   LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_ABS,              },/*P7*/
    {LEVEL_HIGH,    LEVEL_LOW,   LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_Auto_Start_Stop,  },/*P12*/
    {LEVEL_HIGH,    LEVEL_LOW,   LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_Oil_Pressure_Alert, },/*P21*/
    {LEVEL_LOW,    LEVEL_HIGH,   LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_Coolant_Temperature }, /*P11*/
时昊's avatar
时昊 committed
16
};
时昊's avatar
时昊 committed
17
Linelib_uint8_t Get_LINE_IN_Turn_Left(void)
时昊's avatar
时昊 committed
18 19
{
    Linelib_uint8_t ret = 0U;
时昊's avatar
时昊 committed
20
    if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
时昊's avatar
时昊 committed
21 22 23
    {
        ret = 1u;
    }
时昊's avatar
时昊 committed
24
    else
时昊's avatar
时昊 committed
25 26 27 28 29
    {
        ret = 0UL;
    }
    return ret;
}
时昊's avatar
时昊 committed
30
Linelib_uint8_t Get_LINE_IN_Turn_Right(void)
时昊's avatar
时昊 committed
31 32
{
    Linelib_uint8_t ret = 0U;
33
    if (RTE_GPIO_Get_Level(RightTurn_MUC_OUT))
时昊's avatar
时昊 committed
34 35 36
    {
        ret = 1u;
    }
时昊's avatar
时昊 committed
37
    else
时昊's avatar
时昊 committed
38 39 40 41 42
    {
        ret = 0UL;
    }
    return ret;
}
时昊's avatar
时昊 committed
43
Linelib_uint8_t Get_LINE_IN_High_Beam(void)
时昊's avatar
时昊 committed
44 45
{
    Linelib_uint8_t ret = 0U;
46
    if (RTE_GPIO_Get_Level(HighBeam_MCU))
时昊's avatar
时昊 committed
47 48 49
    {
        ret = 1u;
    }
时昊's avatar
时昊 committed
50 51 52 53 54 55 56 57 58
    else
    {
        ret = 0UL;
    }
    return ret;
}
Linelib_uint8_t Get_LINE_IN_Efi_Fault(void)
{
    Linelib_uint8_t ret = 0U;
59
    if (RTE_GPIO_Get_Level(MAINTENANCE_LAMP_OUT))
时昊's avatar
时昊 committed
60 61 62 63 64 65 66 67 68 69 70 71
    {
        ret = 1u;
    }
    else
    {
        ret = 0UL;
    }
    return ret;
}
Linelib_uint8_t Get_LINE_IN_ABS(void)
{
    Linelib_uint8_t ret = 0U;
72
    if (RTE_GPIO_Get_Level(ABS_Faulty_lights))
时昊's avatar
时昊 committed
73 74 75 76
    {
        ret = 1u;
    }
    else
时昊's avatar
时昊 committed
77 78 79 80 81 82 83 84
    {
        ret = 0UL;
    }
    return ret;
}
Linelib_uint8_t Get_LINE_IN_Auto_Start_Stop(void)
{
    Linelib_uint8_t ret = 0U;
85
    if (RTE_GPIO_Get_Level(Start_stop_MCU))
时昊's avatar
时昊 committed
86 87 88 89 90 91 92 93 94 95 96 97
    {
        ret = 1u;
    }
    else
    {
        ret = 0UL;
    }
    return ret;
}
Linelib_uint8_t Get_LINE_IN_Oil_Pressure_Alert(void)
{
    Linelib_uint8_t ret = 0U;
98
    if (RTE_GPIO_Get_Level(Gears_N_MCU))
时昊's avatar
时昊 committed
99 100 101 102 103 104 105 106 107
    {
        ret = 1u;
    }
    else
    {
        ret = 0UL;
    }
    return ret;
}
108
Linelib_uint8_t Get_LINE_IN_Coolant_Temperature(void)
时昊's avatar
时昊 committed
109 110
{
    Linelib_uint8_t ret = 0U;
111
    if (RTE_GPIO_Get_Level(A_WaterTemp_IN))
时昊's avatar
时昊 committed
112 113 114
    {
        ret = 1u;
    }
时昊's avatar
时昊 committed
115
    else
时昊's avatar
时昊 committed
116 117 118 119 120 121
    {
        ret = 0UL;
    }
    return ret;
}

122 123


时昊's avatar
时昊 committed
124 125 126 127 128 129
__align(4)
Linelib_uint8_t LINE_IN_Men[LINE_IN_MAX * LINE_IN_BLOCK_SIZE];

static Linelib_uint16_t LINE_GET_PWR(void)
{
    Linelib_uint16_t Res;
时昊's avatar
时昊 committed
130
    Res = Common_Get_IG_Sts() & 0x00FFu;
时昊's avatar
时昊 committed
131 132 133 134 135 136 137
    return Res;
}

void LINE_IN_Init(void)
{
    Line_In_KL30_WakeUp_Init(LINE_IN_Men, g_stLineInAttribute, LINE_IN_MAX, LINE_GET_PWR);
}