Пример #1
0
void TCON_Init(void)
{
    SetReg(0xA8, CS | SDO | SCL);
    TCON_CTRL(CS, 1);
    TCON_CTRL(SDO, 1);
    TCON_CTRL(SCL, 1);

    DelayMs(20);

    GPIO_TCON(0x0001, 0x6300);  //Driver Output Control
    GPIO_TCON(0x0002, 0x0200);  //LCD-Driving-Waveform Control:N-line inversion,N=0
    GPIO_TCON(0x0003, 0x7184);  //Power control 1:Set the step-up cycle of the step-up circuit for 262k-color mode
    DelayMs(100);
    GPIO_TCON(0x0004, 0x0447);  //Input Data and Color Filter Control
    GPIO_TCON(0x0005, 0xb854);  //Function Control
    GPIO_TCON(0X000a, 0x4008);  //Contrast/Brightness Control

    //    GPIO_TCON(0X000a,0xff18);//Contrast/Brightness Control
    DelayMs(40);
    GPIO_TCON(0x000b, 0xd400);  //Frame Cycle Control
    GPIO_TCON(0x000d, 0x123a);  //Power Control 2
    DelayMs(200);
    GPIO_TCON(0x000e, 0x3000);  //Power Control 3
    DelayMs(200);
    GPIO_TCON(0x000f, 0x0000);  //Gate Scan Position
    GPIO_TCON(0x0016, 0x9f80);  //Horizontal Porch
    GPIO_TCON(0x0017, 0x2212);  //Vertical Porch
    DelayMs(200);
    GPIO_TCON(0x001e, 0x00ef);  //Set the VCOMH voltage
    DelayMs(200);

    GPIO_TCON(0x0030, 0x0507);  //Gamma Control
    GPIO_TCON(0x0031, 0x0004);  //Gamma Control
    GPIO_TCON(0x0032, 0x0707);  //Gamma Control
    GPIO_TCON(0x0033, 0x0000);  //Gamma Control
    GPIO_TCON(0x0034, 0x0000);  //Gamma Control
    GPIO_TCON(0x0035, 0x0307);  //Gamma Control
    GPIO_TCON(0x0036, 0x0700);  //Gamma Control
    GPIO_TCON(0x0037, 0x0000);  //Gamma Control
    GPIO_TCON(0x003a, 0x140b);  //Gamma Control
    GPIO_TCON(0x003b, 0x140b);  //Gamma Control
}
Пример #2
0
/************************************************************************
* Function: void GfxTconWriteCommand(BYTE index, WORD value)                                           
*                                                                       
* Overview: This writes a word to SPI by calling the write byte 
*           routine.
*                                                                       
* Input: index - The index (or address) of the register to be written.
*        value - The value that will be written to the register.
*                                                                       
* Output: none                                 
*                                                                       
************************************************************************/
void GfxTconWriteCommand(WORD index, WORD value)
{
    TCON_CTRL(BB_CS, 0);

    // Index
    TCONWriteByte(0x70);
    TCONWriteByte(((WORD_VAL) index).v[1]);
    TCONWriteByte(((WORD_VAL) index).v[0]);

    TCON_CTRL(BB_CS, 1);
    TCON_Delay();
    TCON_CTRL(BB_CS, 0);

    // Data
    TCONWriteByte(0x72);
    TCONWriteByte(((WORD_VAL) value).v[1]);
    TCONWriteByte(((WORD_VAL) value).v[0]);
    TCON_CTRL(BB_CS, 1);
    TCON_Delay();
}
Пример #3
0
void GPIO_TCON(WORD index, WORD value)
{
    TCON_CTRL(CS, 0);

    // Index
    TCONWriteByte(0x70);
    TCONWriteByte(((WORD_VAL) index).v[1]);
    TCONWriteByte(((WORD_VAL) index).v[0]);

    TCON_CTRL(CS, 1);
    TCON_Delay();
    TCON_CTRL(CS, 0);

    // Data
    TCONWriteByte(0x72);
    TCONWriteByte(((WORD_VAL) value).v[1]);
    TCONWriteByte(((WORD_VAL) value).v[0]);
    TCON_CTRL(CS, 1);
    TCON_Delay();
}
Пример #4
0
void TCONWriteByte(BYTE value)
{
    BYTE    mask;

    mask = 0x80;
    while(mask)
    {
        TCON_CTRL(SCL, 0);
        TCON_Delay();
        if(mask & value)
        {
            TCON_CTRL(SDO, 1);
        }
        else
        {
            TCON_CTRL(SDO, 0);
        }

        TCON_CTRL(SCL, 1);
        mask >>= 1;
    }
}