Line_In_user.c 3.74 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] =
{
时昊's avatar
时昊 committed
8 9 10 11 12 13 14 15 16 17 18
    {LEVEL_HIGH,   LEVEL_LOW,    LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_Turn_Left,        },
    {LEVEL_HIGH,   LEVEL_LOW,    LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_Turn_Right,       },
    {LEVEL_HIGH,   LEVEL_LOW,    LINE_IN_IG_ON,     60U,  20U,  Get_LINE_IN_High_Beam,        },
    {LEVEL_LOW,    LEVEL_HIGH,   LINE_IN_IG_ON,     100U, 20U,  Get_LINE_IN_Efi_Fault,        },
    {LEVEL_HIGH,   LEVEL_LOW,    LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_ABS,              },
    {LEVEL_LOW,    LEVEL_HIGH,   LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_Auto_Start_Stop,  },
    {LEVEL_LOW,    LEVEL_HIGH,   LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_Oil_Pressure_Alert,        },
    {LEVEL_LOW,    LEVEL_HIGH,   LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_Voltage,          },
    {LEVEL_LOW,    LEVEL_HIGH,   LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_Fuel_Level_Low,   },
    {LEVEL_LOW,    LEVEL_HIGH,   LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_E,                },
    {LEVEL_LOW,    LEVEL_HIGH,   LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_S,                },
时昊's avatar
时昊 committed
19
};
时昊's avatar
时昊 committed
20
Linelib_uint8_t Get_LINE_IN_Turn_Left(void)
时昊's avatar
时昊 committed
21 22
{
    Linelib_uint8_t ret = 0U;
时昊's avatar
时昊 committed
23
    if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
时昊's avatar
时昊 committed
24 25 26
    {
        ret = 1u;
    }
时昊's avatar
时昊 committed
27
    else
时昊's avatar
时昊 committed
28 29 30 31 32
    {
        ret = 0UL;
    }
    return ret;
}
时昊's avatar
时昊 committed
33
Linelib_uint8_t Get_LINE_IN_Turn_Right(void)
时昊's avatar
时昊 committed
34 35
{
    Linelib_uint8_t ret = 0U;
时昊's avatar
时昊 committed
36
    if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
时昊's avatar
时昊 committed
37 38 39
    {
        ret = 1u;
    }
时昊's avatar
时昊 committed
40
    else
时昊's avatar
时昊 committed
41 42 43 44 45
    {
        ret = 0UL;
    }
    return ret;
}
时昊's avatar
时昊 committed
46
Linelib_uint8_t Get_LINE_IN_High_Beam(void)
时昊's avatar
时昊 committed
47 48
{
    Linelib_uint8_t ret = 0U;
时昊's avatar
时昊 committed
49
    if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
时昊's avatar
时昊 committed
50 51 52
    {
        ret = 1u;
    }
时昊's avatar
时昊 committed
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
    else
    {
        ret = 0UL;
    }
    return ret;
}
Linelib_uint8_t Get_LINE_IN_Efi_Fault(void)
{
    Linelib_uint8_t ret = 0U;
    if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
    {
        ret = 1u;
    }
    else
    {
        ret = 0UL;
    }
    return ret;
}
Linelib_uint8_t Get_LINE_IN_ABS(void)
{
    Linelib_uint8_t ret = 0U;
    if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
    {
        ret = 1u;
    }
    else
时昊's avatar
时昊 committed
80 81 82 83 84 85 86 87
    {
        ret = 0UL;
    }
    return ret;
}
Linelib_uint8_t Get_LINE_IN_Auto_Start_Stop(void)
{
    Linelib_uint8_t ret = 0U;
时昊's avatar
时昊 committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
    if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
    {
        ret = 1u;
    }
    else
    {
        ret = 0UL;
    }
    return ret;
}
Linelib_uint8_t Get_LINE_IN_Oil_Pressure_Alert(void)
{
    Linelib_uint8_t ret = 0U;
    if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
    {
        ret = 1u;
    }
    else
    {
        ret = 0UL;
    }
    return ret;
}
Linelib_uint8_t Get_LINE_IN_Voltage(void)
{
    Linelib_uint8_t ret = 0U;
    if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
    {
        ret = 1u;
    }
    else
    {
        ret = 0UL;
    }
    return ret;
}
Linelib_uint8_t Get_LINE_IN_Fuel_Level_Low(void)
{
    Linelib_uint8_t ret = 0U;
    if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
    {
        ret = 1u;
    }
    else
    {
        ret = 0UL;
    }
    return ret;
}
Linelib_uint8_t Get_LINE_IN_E(void)
{
    Linelib_uint8_t ret = 0U;
    if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
    {
        ret = 1u;
    }
    else
    {
        ret = 0UL;
    }
    return ret;
}
Linelib_uint8_t Get_LINE_IN_S(void)
{
    Linelib_uint8_t ret = 0U;
    if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
时昊's avatar
时昊 committed
154 155 156
    {
        ret = 1u;
    }
时昊's avatar
时昊 committed
157
    else
时昊's avatar
时昊 committed
158 159 160 161 162 163 164 165 166 167 168 169
    {
        ret = 0UL;
    }
    return ret;
}

__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
170
    Res = Common_Get_IG_Sts() & 0x00FFu;
时昊's avatar
时昊 committed
171 172 173 174 175 176 177
    return Res;
}

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