Пример #1
0
void configure_gpio(){
    GPIO_SetPinDirection(BANK4, PIN0, OUT);
    GPIO_SetPinDirection(BANK6, PIN8, IN);      //Key_0
    GPIO_SetPinDirection(BANK6, PIN9, IN);      //Key_2
    GPIO_SetPinDirection(BANK6, PIN10, IN);     //Key_3
    GPIO_SetPinDirection(BANK6, PIN11, IN);     //Key_1
}
Пример #2
0
int lcd_init(void)
{
    int i = 0;

#if 0
    GPIO_SetPinDirection(reset_pin, GPIO_OUT);
    GPIO_SetPinLevel(reset_pin,GPIO_HIGH);
    DelayMs_nops(100);
    GPIO_SetPinLevel(reset_pin,GPIO_LOW);
    DelayMs_nops(100);
    GPIO_SetPinLevel(reset_pin,GPIO_HIGH);
#endif

    mcu_ioctl(MCU_SETBYPASS, 1);



    Set_LCD_8B_REG(0xC0,0X00,0x86);

    Set_LCD_8B_REG(0xC0,0X01,0x00);
    Set_LCD_8B_REG(0xC0,0X02,0x86);
    Set_LCD_8B_REG(0xC0,0X03,0x00);

    Set_LCD_8B_REG(0xC1,0X00,0x60); //0x004f
    Set_LCD_8B_REG(0xC2,0X00,0x21);
    Set_LCD_8B_REG(0xC2,0X02,0x70); //0x0202

    Set_LCD_8B_REG(0xB6,0x00,0x10); //0x0030
    Set_LCD_8B_REG(0xB6,0x02,0x30);

    Set_LCD_8B_REG(0xC7,0X00,0x6F);

    Set_LCD_8B_REG(0xE0,0X00,0X0E);
    Set_LCD_8B_REG(0xE0,0X01,0X14);
    Set_LCD_8B_REG(0xE0,0X02,0X29);
    Set_LCD_8B_REG(0xE0,0X03,0X3A);
    Set_LCD_8B_REG(0xE0,0X04,0X1D);
    Set_LCD_8B_REG(0xE0,0X05,0X30);
    Set_LCD_8B_REG(0xE0,0X06,0X61);
    Set_LCD_8B_REG(0xE0,0X07,0X3D);
    Set_LCD_8B_REG(0xE0,0X08,0X22);
    Set_LCD_8B_REG(0xE0,0X09,0X2A);
    Set_LCD_8B_REG(0xE0,0X0A,0X87);
    Set_LCD_8B_REG(0xE0,0X0B,0X16);
    Set_LCD_8B_REG(0xE0,0X0C,0X3B);
    Set_LCD_8B_REG(0xE0,0X0D,0X4C);
    Set_LCD_8B_REG(0xE0,0X0E,0X78);
    Set_LCD_8B_REG(0xE0,0X0F,0X96);
    Set_LCD_8B_REG(0xE0,0X10,0X4A);
    Set_LCD_8B_REG(0xE0,0X11,0X4D);

    Set_LCD_8B_REG(0xE1,0X00,0X0E);
    Set_LCD_8B_REG(0xE1,0X01,0X14);
    Set_LCD_8B_REG(0xE1,0X02,0X29);
    Set_LCD_8B_REG(0xE1,0X03,0X3A);
    Set_LCD_8B_REG(0xE1,0X04,0X1D);
    Set_LCD_8B_REG(0xE1,0X05,0X30);
    Set_LCD_8B_REG(0xE1,0X06,0X61);
    Set_LCD_8B_REG(0xE1,0X07,0X3F);
    Set_LCD_8B_REG(0xE1,0X08,0X20);
    Set_LCD_8B_REG(0xE1,0X09,0X26);
    Set_LCD_8B_REG(0xE1,0X0A,0X83);
    Set_LCD_8B_REG(0xE1,0X0B,0X16);
    Set_LCD_8B_REG(0xE1,0X0C,0X3B);
    Set_LCD_8B_REG(0xE1,0X0D,0X4C);
    Set_LCD_8B_REG(0xE1,0X0E,0X78);
    Set_LCD_8B_REG(0xE1,0X0F,0X96);
    Set_LCD_8B_REG(0xE1,0X10,0X4A);
    Set_LCD_8B_REG(0xE1,0X11,0X4D);

    Set_LCD_8B_REG(0xE2,0X00,0X0E);
    Set_LCD_8B_REG(0xE2,0X01,0X14);
    Set_LCD_8B_REG(0xE2,0X02,0X29);
    Set_LCD_8B_REG(0xE2,0X03,0X3A);
    Set_LCD_8B_REG(0xE2,0X04,0X1D);
    Set_LCD_8B_REG(0xE2,0X05,0X30);
    Set_LCD_8B_REG(0xE2,0X06,0X61);
    Set_LCD_8B_REG(0xE2,0X07,0X3D);
    Set_LCD_8B_REG(0xE2,0X08,0X22);
    Set_LCD_8B_REG(0xE2,0X09,0X2A);
    Set_LCD_8B_REG(0xE2,0X0A,0X87);
    Set_LCD_8B_REG(0xE2,0X0B,0X16);
    Set_LCD_8B_REG(0xE2,0X0C,0X3B);
    Set_LCD_8B_REG(0xE2,0X0D,0X4C);
    Set_LCD_8B_REG(0xE2,0X0E,0X78);
    Set_LCD_8B_REG(0xE2,0X0F,0X96);
    Set_LCD_8B_REG(0xE2,0X10,0X4A);
    Set_LCD_8B_REG(0xE2,0X11,0X4D);

    Set_LCD_8B_REG(0xE3,0X00,0X0E);
    Set_LCD_8B_REG(0xE3,0X01,0X14);
    Set_LCD_8B_REG(0xE3,0X02,0X29);
    Set_LCD_8B_REG(0xE3,0X03,0X3A);
    Set_LCD_8B_REG(0xE3,0X04,0X1D);
    Set_LCD_8B_REG(0xE3,0X05,0X30);
    Set_LCD_8B_REG(0xE3,0X06,0X61);
    Set_LCD_8B_REG(0xE3,0X07,0X3F);
    Set_LCD_8B_REG(0xE3,0X08,0X20);
    Set_LCD_8B_REG(0xE3,0X09,0X26);
    Set_LCD_8B_REG(0xE3,0X0A,0X83);
    Set_LCD_8B_REG(0xE3,0X0B,0X16);
    Set_LCD_8B_REG(0xE3,0X0C,0X3B);
    Set_LCD_8B_REG(0xE3,0X0D,0X4C);
    Set_LCD_8B_REG(0xE3,0X0E,0X78);
    Set_LCD_8B_REG(0xE3,0X0F,0X96);
    Set_LCD_8B_REG(0xE3,0X10,0X4A);
    Set_LCD_8B_REG(0xE3,0X11,0X4D);

    Set_LCD_8B_REG(0xE4,0X00,0X0E);
    Set_LCD_8B_REG(0xE4,0X01,0X14);
    Set_LCD_8B_REG(0xE4,0X02,0X29);
    Set_LCD_8B_REG(0xE4,0X03,0X3A);
    Set_LCD_8B_REG(0xE4,0X04,0X1D);
    Set_LCD_8B_REG(0xE4,0X05,0X30);
    Set_LCD_8B_REG(0xE4,0X06,0X61);
    Set_LCD_8B_REG(0xE4,0X07,0X3D);
    Set_LCD_8B_REG(0xE4,0X08,0X22);
    Set_LCD_8B_REG(0xE4,0X09,0X2A);
    Set_LCD_8B_REG(0xE4,0X0A,0X87);
    Set_LCD_8B_REG(0xE4,0X0B,0X16);
    Set_LCD_8B_REG(0xE4,0X0C,0X3B);
    Set_LCD_8B_REG(0xE4,0X0D,0X4C);
    Set_LCD_8B_REG(0xE4,0X0E,0X78);
    Set_LCD_8B_REG(0xE4,0X0F,0X96);
    Set_LCD_8B_REG(0xE4,0X10,0X4A);
    Set_LCD_8B_REG(0xE4,0X11,0X4D);

    Set_LCD_8B_REG(0xE5,0X00,0X0E);
    Set_LCD_8B_REG(0xE5,0X01,0X14);
    Set_LCD_8B_REG(0xE5,0X02,0X29);
    Set_LCD_8B_REG(0xE5,0X03,0X3A);
    Set_LCD_8B_REG(0xE5,0X04,0X1D);
    Set_LCD_8B_REG(0xE5,0X05,0X30);
    Set_LCD_8B_REG(0xE5,0X06,0X61);
    Set_LCD_8B_REG(0xE5,0X07,0X3F);
    Set_LCD_8B_REG(0xE5,0X08,0X20);
    Set_LCD_8B_REG(0xE5,0X09,0X26);
    Set_LCD_8B_REG(0xE5,0X0A,0X83);
    Set_LCD_8B_REG(0xE5,0X0B,0X16);
    Set_LCD_8B_REG(0xE5,0X0C,0X3B);
    Set_LCD_8B_REG(0xE5,0X0D,0X4C);
    Set_LCD_8B_REG(0xE5,0X0E,0X78);
    Set_LCD_8B_REG(0xE5,0X0F,0X96);
    Set_LCD_8B_REG(0xE5,0X10,0X4A);
    Set_LCD_8B_REG(0xE5,0X11,0X4D);

    Set_LCD_8B_REG(0x36,0X01,0X01);

    Set_LCD_8B_REG(0x11,0X00,0X00);
    msleep(100);
    Set_LCD_8B_REG(0x29,0X00,0X00);
    msleep(100);


    Set_LCD_8B_REG(0x2a,0X00,0X00);
    Set_LCD_8B_REG(0x2a,0X01,0X00);
    Set_LCD_8B_REG(0x2a,0X02,0X01);
    Set_LCD_8B_REG(0x2a,0X03,0Xdf);
    msleep(100);
    Set_LCD_8B_REG(0x2b,0X00,0X00);
    Set_LCD_8B_REG(0x2b,0X01,0X00);
    Set_LCD_8B_REG(0x2b,0X02,0X03);
    Set_LCD_8B_REG(0x2b,0X03,0X1f);
    msleep(100);
    {
        uint32 fte = 0;
        Set_LCD_8B_REG(0x44,0x00,(fte>>8)&0xff);
        Set_LCD_8B_REG(0x44,0x01,(fte)&0xff);
    }
    Set_LCD_8B_REG(0x0E,0X00,0X80);
    Set_LCD_8B_REG(0x35,0X00,0X80);

#if (480==H_VD)
    Set_LCD_8B_REG(0x36,0X00,0x00);
#else
    Set_LCD_8B_REG(0x36,0X00,0x22);
#endif
    Set_LCD_8B_REG(0x2c,0X00,-1);

    for(i=0; i<480*800; i++) {
        mcu_ioctl(MCU_WRDATA, 0x00000000);
    }

#if 0
    // for test
    while(1) {
        int i = 0;
        for(i=0; i<400*480; i++)
            mcu_ioctl(MCU_WRDATA, 0xffffffff);
        for(i=0; i<400*480; i++)
            mcu_ioctl(MCU_WRDATA, 0x00000000);
        msleep(1000);
        printk(">>>>> MCU_WRDATA ...\n");

        for(i=0; i<400*480; i++)
            mcu_ioctl(MCU_WRDATA, 0x00000000);
        for(i=0; i<400*480; i++)
            mcu_ioctl(MCU_WRDATA, 0xffffffff);
        msleep(1000);
        printk(">>>>> MCU_WRDATA ...\n");
    }
#endif

    mcu_ioctl(MCU_SETBYPASS, 0);
    return 0;
}