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

📄 api_panel.c

📁 其乐达(Cheertek)LCD驱动芯片(CT675)的C51源代码
💻 C
字号:
#include "..\INC\SYS_DECLARE.H"
#include "..\INC\SYS_GLOBAL.H"
#include "..\INC\SYS_INITIAL.H"

#include "INC\API_IIC.H"
#include "INC\API_CTRL.H"
#include "INC\API_EEPROM.H"
#include "INC\API_PANEL.H"
#include "INC\API_REG.H"

#if(PANEL_MODULE == AU_A070FW03)
    #include "PANEL\AU_A070FW03.C"
#endif // PANEL_MODULE

void API_PANEL_Initial(void)
{
    API_CTRL_DCDCEnable(0);

    API_CTRL_AdcAutoBalance();

    API_PANEL_ChangeMode(gSysInfo.bInputSource, (gSysInfo.bVideoLines == EN_VIDEO_LN625) ? 1 : 0);

    SYS_Delay_mS(150);
    SYS_Delay_mS(250);
}

void API_PANEL_ChangeMode(BYTE bSource, BOOL fMode)
{
    // Initial ADC, Video Decoder, Scaler
    if(bSource == EN_INPUT_CCIR656)
        API_IIC_WriteTable(VideoCcir656Table[fMode]);
    else if(bSource == EN_INPUT_SVIDEO)
        API_IIC_WriteTable(VideoSvideoTable[fMode]);
    else if(bSource == EN_INPUT_TV)
        API_IIC_WriteTable(VideoTvTable[fMode]);
    else
        API_IIC_WriteTable(VideoCvbsTable[fMode]);

    API_CTRL_ScalerColorEnhance();

    API_IIC_WriteTable(TConTable);          // Initial Timing Controller
    API_IIC_WriteTable(DCDCTable);          // Initial DC-DC

    API_EEPROM_WithdrawParameters(EE_SCALER);
    API_EEPROM_WithdrawParameters(EE_SC_COLOR);

    API_PANEL_SetAspectRatio(gScalerPara.fAspectType);
    API_CTRL_ScalerColorEnhance();

    // Initital Gamma LUT
    API_CTRL_GammaCorrection(gScalerPara.fGammaCorrect);

    API_PANEL_Flip(0);                      // Set panel flip direction
    API_CTRL_SetBacklightBrightness(0xFF);

    // Force flow control routine initial.
    gfFlowControlInitial = 1;
}

void API_PANEL_Flip(BYTE bStatus)
{
    BOOL UDC, LRC, stUDC, stLRC;
    BYTE it;

    /*
     *  bStatus:    00 -> normal,       01 -> LR inverse,
     *              10 -> UD inverse,   11 -> All inverse
     */
    stUDC = (BOOL)(bStatus & 0x02);
    stLRC = (BOOL)(bStatus & 0x01);

    UDC = (BOOL)(PanelFlipTable[0] & 0x02);
    LRC = (BOOL)(PanelFlipTable[0] & 0x01);

#if 1 // use mcu i/o pin
    PANEL_UDC_PIN = (UDC | stUDC) & ~(UDC & stUDC);
    PANEL_LRC_PIN = (LRC | stLRC) & ~(LRC & stLRC);
#endif

    it = stLRC ? 3 : 1;
    API_TC_WriteByte(0x02, PanelFlipTable[it]);

    it = stUDC ? 4 : 2;
    API_TC_WriteByte(0x05, PanelFlipTable[it]);
}

void API_PANEL_SetAspectRatio(BOOL fRatio)
{
    BYTE bval = 0, ix;

    bval = API_SC_ReadByte(0x1E);
    for(ix = 0; ix < 250; ix++)
    {
        if((bval != API_SC_ReadByte(REG_SC_IV_TOTAL)) || (ix > 245))
        {
            API_SC_WriteByte(0x09, 0x02);
            API_IIC_WriteTable(ZoomTable[fRatio]);
            SYS_Delay_mS(20);  // DO NOT remove this delay routine.
            API_SC_WriteByte(0x09, 0x03);
            break;
        }
    }
}

⌨️ 快捷键说明

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