⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ui_flow_menu.c

📁 其乐达(Cheertek)LCD驱动芯片(CT675)的C51源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
    gbFocusItemIdx = 0;

    for(i = 0; i < MENU_INPUT_ITEM_MAX; i++)
        UI_FL_InputDrawItem(i, ( (i == 0) ? FOCUS_COLOR : UNFOCUS_COLOR ) );
}

/***************************************************************************/
void UI_FL_InputProc(BYTE bKey)
{
#if(UART_DEBUG_MSG)
    printf("...menu_input_proc(%02X)\n", (int)bKey);
#endif // UART_DEBUG_MSG

    switch(bKey)
    {
        case KEY_LEFT:
        case KEY_EXIT:
            API_OSD_ClearArea(0, MENU_INPUT_ITEM_MAX + 1, 0, 9, OSD_BLACK);
            UI_FLC_ReturnLastState();
            break;

        case KEY_UP:
            UI_FL_InputDrawItem(gbFocusItemIdx, UNFOCUS_COLOR);

            if(gbFocusItemIdx)  gbFocusItemIdx--;
            else                gbFocusItemIdx = MENU_INPUT_ITEM_MAX - 1;

            UI_FL_InputDrawItem(gbFocusItemIdx, FOCUS_COLOR);
            break;

        case KEY_DOWN:
            UI_FL_InputDrawItem(gbFocusItemIdx, UNFOCUS_COLOR);

            gbFocusItemIdx++;
            if(gbFocusItemIdx == MENU_INPUT_ITEM_MAX) gbFocusItemIdx = 0;

            UI_FL_InputDrawItem(gbFocusItemIdx, FOCUS_COLOR);
            break;

        case KEY_MENU:
            UI_FLC_EnterNewState(FS_INPUT_CVBS + gbFocusItemIdx);
            break;

        default:
            break;
    }
}

/***************************************************************************/
void UI_FL_InputSourceSwitch(void)
{
    EN_FLOW_STATE enCurrentState = UI_FLC_GetCurrentState();

#if(UART_DEBUG_MSG)
    printf("......input_source_switch\n");
#endif // UART_DEBUG_MSG

    API_OSD_Enable(0);
    UI_FLC_Reset();

    if(enCurrentState == FS_INPUT_CVBS)
        API_CTRL_SwitchSource(EN_INPUT_CVBS);
    else if(enCurrentState == FS_INPUT_SVIDEO)
        API_CTRL_SwitchSource(EN_INPUT_SVIDEO);
    /*
    else if(enCurrentState == FS_INPUT_TV)
        API_CTRL_SwitchSource(EN_INPUT_TV);
    else // (enCurrentState == FS_INPUT_CCIR656)
        API_CTRL_SwitchSource(EN_INPUT_CCIR656);
    */

    UI_FLC_EnterNewState(FS_NORMAL_PLAY);
    API_OSD_Enable(1);
}

#if 0
/****************************************************************************
 * UI Menu function - TV sub-menu
 ****************************************************************************/
BYTE code MTvItemStr1[] = { _A, _U, _T, _O, __, _S, _C, _A, _N, _EOF };

BYTE code * code MTvItemStr[] =
{
    MTvItemStr1
};

/***************************************************************************/
void UI_FL_TvDrawItem(BYTE bIndex, BYTE bColor)
{
    API_OSD_PrintString(bIndex+1, 1, bColor, MTvItemStr[bIndex]);
}

/***************************************************************************/
void UI_FL_TvInit(void)
{
    BYTE i;

#if(UART_DEBUG_MSG)
    printf("...menu_tv_init\n");
#endif // UART_DEBUG_MSG

#if(MAIN_MENU_ITEM_MAX < MENU_TV_ITEM_MAX)
    UI_OSD_SetAreaRowAttr(0, MENU_TV_ITEM_MAX + 1, 0x00, 0x14);
#endif // MAIN_MENU_ITEM_MAX < MENU_TV_ITEM_MAX

    API_OSD_ClearRow(0, 15, OSD_BLACK);
    UI_OSD_DrawFrame(0, MENU_TV_ITEM_MAX + 1, 0, 10);
    gbFocusItemIdx = 0;

    for(i = 0; i < MENU_TV_ITEM_MAX; i++)
        UI_FL_TvDrawItem(i, ( (i == 0) ? FOCUS_COLOR : UNFOCUS_COLOR ) );
}

/***************************************************************************/
void UI_FL_TvProc(BYTE bKey)
{
#if(UART_DEBUG_MSG)
    printf("...main_tv_proc(%02X)\n", (int)bKey);
#endif // UART_DEBUG_MSG

    switch(bKey)
    {
        case KEY_LEFT:
        case KEY_EXIT:
            API_OSD_ClearArea(0, MENU_TV_ITEM_MAX + 1, 0, 10, OSD_BLACK);
            UI_FLC_ReturnLastState();
            break;

        case KEY_UP:
            UI_FL_TvDrawItem(gbFocusItemIdx, UNFOCUS_COLOR);

            if(gbFocusItemIdx)  gbFocusItemIdx--;
            else                gbFocusItemIdx = MENU_TV_ITEM_MAX - 1;

            UI_FL_TvDrawItem(gbFocusItemIdx, FOCUS_COLOR);
            break;

        case KEY_DOWN:
            UI_FL_TvDrawItem(gbFocusItemIdx, UNFOCUS_COLOR);

            gbFocusItemIdx++;
            if(gbFocusItemIdx == MENU_TV_ITEM_MAX) gbFocusItemIdx = 0;

            UI_FL_TvDrawItem(gbFocusItemIdx, FOCUS_COLOR);
            break;

        case KEY_MENU:
            // Clear all row data
            // set flow state to FS_TV_AUTOSCAN
            break;

        default:
            break;
    }
}

/***************************************************************************/
void UI_FL_TvAutoScanInit(void)
{
}

void UI_FL_TvAutoScanProc(BYTE bKey)
{
    bKey = bKey;
}
#endif

/****************************************************************************
 * UI Menu function - Factory mode sub-menu
 ****************************************************************************/
BYTE code MFacItemStr1[] = { _B, _A, _T, _T, _E, _R, _Y, __, _L, _V, _EOF };
BYTE code MFacItemStr2[] = { _E, _N, _V, __, _D, _E, _T, _E, _C, _T, _EOF };
BYTE code MFacItemStr3[] = { _G, _A, _M, _M, _A, __, __, __, __, __, _EOF };
BYTE code MFacItemStr4[] = { _S, _A, _R, _MINUS, _A, _D, _C, __, _L, _V, _EOF };

BYTE code * code MFacItemStr[] =
{
    MFacItemStr1,
    MFacItemStr2,
    MFacItemStr3,
    MFacItemStr4
};

/***************************************************************************/
void UI_FL_FacDrawItem(BYTE bIndex, BYTE bColor)
{
    API_OSD_PrintString(bIndex+1, 1, bColor, MFacItemStr[bIndex]);
}

/***************************************************************************/
void UI_FL_FacInit(void)
{
    BYTE i;

#if(UART_DEBUG_MSG)
    printf("...menu_factory_init\n");
#endif // UART_DEBUG_MSG

#if(MAIN_MENU_ITEM_MAX < MENU_FACTORY_ITEM_MAX)
    UI_OSD_SetAreaRowAttr(0, MENU_FACTORY_ITEM_MAX + 1, 0x00, 0x14);
#endif // MAIN_MENU_ITEM_MAX < MENU_FACTORY_ITEM_MAX

    API_OSD_ClearRow(0, 15, OSD_BLACK);
    UI_OSD_DrawFrame(0, MENU_FACTORY_ITEM_MAX + 1, 0, 11);
    gbFocusItemIdx = 0;

    for(i = 0; i < MENU_FACTORY_ITEM_MAX; i++)
        UI_FL_FacDrawItem(i, ( (i == 0) ? FOCUS_COLOR : UNFOCUS_COLOR ) );
}

/***************************************************************************/
void UI_FL_FacProc(BYTE bKey)
{
#if(UART_DEBUG_MSG)
    printf("...main_factory_proc(%02X)\n", (int)bKey);
#endif // UART_DEBUG_MSG

    switch(bKey)
    {
        case KEY_LEFT:
        case KEY_EXIT:
            API_OSD_ClearArea(0, MENU_FACTORY_ITEM_MAX + 1, 0, 11, OSD_BLACK);
            UI_FLC_ReturnLastState();
            break;

        case KEY_UP:
            UI_FL_FacDrawItem(gbFocusItemIdx, UNFOCUS_COLOR);

            if(gbFocusItemIdx)  gbFocusItemIdx--;
            else                gbFocusItemIdx = MENU_FACTORY_ITEM_MAX - 1;

            UI_FL_FacDrawItem(gbFocusItemIdx, FOCUS_COLOR);
            break;

        case KEY_DOWN:
            UI_FL_FacDrawItem(gbFocusItemIdx, UNFOCUS_COLOR);

            gbFocusItemIdx++;
            if(gbFocusItemIdx == MENU_FACTORY_ITEM_MAX) gbFocusItemIdx = 0;

            UI_FL_FacDrawItem(gbFocusItemIdx, FOCUS_COLOR);
            break;

        case KEY_MENU:
            UI_FLC_EnterNewState(FS_FACTORY_BATTERY + gbFocusItemIdx);
            break;

        default:
            break;
    }
}

/***************************************************************************/
void UI_FL_FacBatteryInit(void)
{
#if(UART_DEBUG_MSG)
    printf("......factory_battery_init\n");
#endif // UART_DEBUG_MSG
    _CheckedItemWindowInit(MFacItemStr1, gScalerPara.fBatteryDetect);
}

void UI_FL_FacBatteryProc(BYTE bKey)
{
#if(UART_DEBUG_MSG)
    printf("......factory_battery_proc(%02X)\n", (int)bKey);
#endif // UART_DEBUG_MSG

    if(bKey == KEY_LEFT || bKey == KEY_RIGHT)
    {
        gScalerPara.fBatteryDetect = _CheckedItemWindowProc(gScalerPara.fBatteryDetect);
    }
    else if(bKey == KEY_EXIT)
    {
        _ItemWindowExit();
    }
}

/***************************************************************************/
void UI_FL_FacEnvDetectInit(void)
{
#if(UART_DEBUG_MSG)
    printf("......factory_envdetect_init\n");
#endif // UART_DEBUG_MSG
    _CheckedItemWindowInit(MFacItemStr2, gScalerPara.fAutoBklitCtrl);
}

void UI_FL_FacEnvDetectProc(BYTE bKey)
{
#if(UART_DEBUG_MSG)
    printf("......factory_envdetect_proc(%02X)\n", (int)bKey);
#endif // UART_DEBUG_MSG

    if(bKey == KEY_LEFT || bKey == KEY_RIGHT)
    {
        gScalerPara.fAutoBklitCtrl = _CheckedItemWindowProc(gScalerPara.fAutoBklitCtrl);
    }
    else if(bKey == KEY_EXIT)
    {
        _ItemWindowExit();
    }
}

/***************************************************************************/
void UI_FL_FacGammaInit(void)
{
#if(UART_DEBUG_MSG)
    printf("......factory_gamma_init\n");
#endif // UART_DEBUG_MSG
    _CheckedItemWindowInit(MFacItemStr3, gScalerPara.fGammaCorrect);
}

void UI_FL_FacGammaProc(BYTE bKey)
{
#if(UART_DEBUG_MSG)
    printf("......factory_gamma_proc(%02X)\n", (int)bKey);
#endif // UART_DEBUG_MSG

    if(bKey == KEY_LEFT || bKey == KEY_RIGHT)
    {
        gScalerPara.fGammaCorrect = _CheckedItemWindowProc(gScalerPara.fGammaCorrect);
        API_CTRL_GammaCorrection(gScalerPara.fGammaCorrect);
    }
    else if(bKey == KEY_EXIT)
    {
        _ItemWindowExit();
    }
}

/***************************************************************************/
void UI_FL_FacSarAdcInit(void)
{
    BYTE bval = API_CTRL_GetSarAdcValue(0);
    _AdjItemWindowInit(MFacItemStr4, bval);
}

void UI_FL_FacSarAdcProc(BYTE bKey)
{
    BYTE bval;

    if(bKey == KEY_EXIT)
        _ItemWindowExit();
    else
    {
        bval = API_CTRL_GetSarAdcValue(0);
        UI_OSD_DrawProgressBar(1, 15, bval, gSysInfo.fFactoryMode);
    }
}

/****************************************************************************
 * UI Menu function - Dummy function
 ****************************************************************************/
void UI_FL_DoNothing(BYTE bKey)
{
    bKey = bKey;
    return;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -