#include "RTE_GPIO.h"
#include "Key.h"
#include "Display_Info.h"
#include "Check_Ctrl.h"

void Key_Operation_SW5(Key_Event_en_t enKeyEvent)
{
    if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
    {
        Display_Add( );
        Display_TFT_Clear( );
        Display_Sch( );
        MENU_CHECK_Init( );
    }
    else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
    {
    }
    else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
    {
    }
    else
    {
    }
}
void Key_Operation_SW6(Key_Event_en_t enKeyEvent)
{
    if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
    {
        Display_Sub( );
        Display_TFT_Clear( );
        Display_Sch( );
        MENU_CHECK_Init( );
    }
    else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
    {
    }
    else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
    {
    }
    else
    {
    }
}
void Key_Operation_SW7(Key_Event_en_t enKeyEvent)
{
    if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
    {
        MENU_CHECK_STEP_ADD( );
        TFT_CHECN_BEGIN   = 0;
        LCD_CHECN_BEGIN   = 0;
        VOICE_CHECN_BEGIN = 0;
        VOICE_BACK_BEGIN  = 0;
        VOICE_CHECK_BEGIN = 0;
    }
    else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
    {
    }
    else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
    {
    }
    else
    {
    }
}
void Key_Operation_SW8(Key_Event_en_t enKeyEvent)
{
    if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
    {
        MENU_CHECK_STEP_SUB( );
        TFT_CHECN_BEGIN   = 0;
        LCD_CHECN_BEGIN   = 0;
        VOICE_CHECN_BEGIN = 0;
        VOICE_BACK_BEGIN  = 0;
        VOICE_CHECK_BEGIN = 0;
    }
    else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
    {
    }
    else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
    {
    }
    else
    {
    }
}
void Key_Operation_SW9(Key_Event_en_t enKeyEvent)
{
    if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
    {
    }
    else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
    {
    }
    else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
    {
    }
    else
    {
    }
}
void Key_Operation_SW10(Key_Event_en_t enKeyEvent)
{
        /*清零ODO*/
    if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
    {
        HW_ODO_Clear();
    }
    else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
    {
    }
    else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
    {
    }
    else
    {
    }
}

/*-------------------------------------------------*/
Key_Real_Status_en_t Key_Real_sw5(void)
{

    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    if ( SW5 == 0U )
    {
        enKeyRealStatus = KEY_LINE_PRESS;
    }
    else
    {
        enKeyRealStatus = KEY_LINE_LOOSEN;
    }
    return enKeyRealStatus;
}
Key_Real_Status_en_t Key_Real_sw6(void)
{

    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;

    if ( SW6 == 0U )
    {
        enKeyRealStatus = KEY_LINE_PRESS;
    }
    return enKeyRealStatus;
}
Key_Real_Status_en_t Key_Real_sw7(void)
{

    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;

    if ( SW1 == 0U )
    {
        enKeyRealStatus = KEY_LINE_PRESS;
    }
    return enKeyRealStatus;
}
Key_Real_Status_en_t Key_Real_sw8(void)
{

    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;

    if ( SW2 == 0U )
    {
        enKeyRealStatus = KEY_LINE_PRESS;
    }
    return enKeyRealStatus;
}
Key_Real_Status_en_t Key_Real_sw9(void)
{

    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;

    if ( SW9 == 0U )
    {
        enKeyRealStatus = KEY_LINE_PRESS;
    }
    return enKeyRealStatus;
}
Key_Real_Status_en_t Key_Real_sw10(void)
{

    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;

    if ( SW4 == 0U )
    {
        enKeyRealStatus = KEY_LINE_PRESS;
    }
    return enKeyRealStatus;
}

/*---------------------------------------------------------------------------------------*/
const Key_Attribute_st_t stKeyAttribute [ KEY_NUM_MAX ] = {
    {KEY_TYPE_LINE, Key_Real_sw5, Key_Operation_SW5},
    {KEY_TYPE_LINE, Key_Real_sw6, Key_Operation_SW6},
    {KEY_TYPE_LINE, Key_Real_sw7, Key_Operation_SW7},
    {KEY_TYPE_LINE, Key_Real_sw8, Key_Operation_SW8},
    {KEY_TYPE_LINE, Key_Real_sw9, Key_Operation_SW9},
    {KEY_TYPE_LINE, Key_Real_sw10, Key_Operation_SW10},

};
