Line_In_user.c 1.65 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
    {LEVEL_LOW,    LEVEL_HIGH,   LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_TurnLeft,        },
    {LEVEL_LOW,    LEVEL_HIGH,   LINE_IN_IG_ON,     20U,  20U,  Get_LINE_IN_TurnRight,       },
    {LEVEL_HIGH,    LEVEL_LOW,   LINE_IN_IG_ON,     60U,  20U,  Get_LINE_IN_HighBeam,        },
    {LEVEL_HIGH,   LEVEL_LOW,    LINE_IN_IG_ON,     100U, 20U,  Get_LINE_IN_Auto_Start_Stop, },
时昊's avatar
时昊 committed
12
};
13 14 15


Linelib_uint8_t Get_LINE_IN_TurnLeft(void)
时昊's avatar
时昊 committed
16 17
{
    Linelib_uint8_t ret = 0U;
18
    //if (RTE_GPIO_Get_Level(LeftTurn_P_In))
时昊's avatar
时昊 committed
19 20 21
    {
        ret = 1u;
    }
22
    //else
时昊's avatar
时昊 committed
23 24 25 26 27
    {
        ret = 0UL;
    }
    return ret;
}
28 29

Linelib_uint8_t Get_LINE_IN_TurnRight(void)
时昊's avatar
时昊 committed
30 31
{
    Linelib_uint8_t ret = 0U;
32
    //if (RTE_GPIO_Get_Level(RightTurn_P_In))
时昊's avatar
时昊 committed
33 34 35
    {
        ret = 1u;
    }
36
    //else
时昊's avatar
时昊 committed
37 38 39 40 41
    {
        ret = 0UL;
    }
    return ret;
}
42 43

Linelib_uint8_t Get_LINE_IN_HighBeam(void)
时昊's avatar
时昊 committed
44 45
{
    Linelib_uint8_t ret = 0U;
46
    //if (RTE_GPIO_Get_Level(HighBeam_P_In))
时昊's avatar
时昊 committed
47 48 49
    {
        ret = 1u;
    }
50
    //else
时昊's avatar
时昊 committed
51 52 53 54 55
    {
        ret = 0UL;
    }
    return ret;
}
56

时昊's avatar
时昊 committed
57 58 59
Linelib_uint8_t Get_LINE_IN_Auto_Start_Stop(void)
{
    Linelib_uint8_t ret = 0U;
60
    //if (RTE_GPIO_Get_Level(START_STOP_P_IN))
时昊's avatar
时昊 committed
61 62 63
    {
        ret = 1u;
    }
64
    //else
时昊's avatar
时昊 committed
65 66 67 68 69 70 71 72 73 74 75 76
    {
        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;
77
    //Res = Common_Get_IG_Sts() & 0x00FFu;
时昊's avatar
时昊 committed
78 79 80 81 82 83 84
    return Res;
}

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