示例#1
0
文件: gdisp_lld.c 项目: GottZ/olvfw
bool_t gdisp_lld_init(void) {
	/* Initialise your display */
	gdisp_lld_init_board();

	/* Hardware reset */
	gdisp_lld_reset_pin(TRUE);
	lld_lcdDelay(1000);
	gdisp_lld_reset_pin(FALSE);
	lld_lcdDelay(1000);

	// chinese code starts here
	lld_lcdWriteReg(0x0000,0x0001);
	lld_lcdDelay(10);

	lld_lcdWriteReg(0x0015,0x0030);
	lld_lcdWriteReg(0x0011,0x0040);
	lld_lcdWriteReg(0x0010,0x1628);
	lld_lcdWriteReg(0x0012,0x0000);
	lld_lcdWriteReg(0x0013,0x104d);
	lld_lcdDelay(10);
	lld_lcdWriteReg(0x0012,0x0010);
	lld_lcdDelay(10);
	lld_lcdWriteReg(0x0010,0x2620);
	lld_lcdWriteReg(0x0013,0x344d); //304d
	lld_lcdDelay(10);

	lld_lcdWriteReg(0x0001,0x0100);
	lld_lcdWriteReg(0x0002,0x0300);
	lld_lcdWriteReg(0x0003,0x1038);//0x1030
	lld_lcdWriteReg(0x0008,0x0604);
	lld_lcdWriteReg(0x0009,0x0000);
	lld_lcdWriteReg(0x000A,0x0008);

	lld_lcdWriteReg(0x0041,0x0002);
	lld_lcdWriteReg(0x0060,0x2700);
	lld_lcdWriteReg(0x0061,0x0001);
	lld_lcdWriteReg(0x0090,0x0182);
	lld_lcdWriteReg(0x0093,0x0001);
	lld_lcdWriteReg(0x00a3,0x0010);
	lld_lcdDelay(10);

	//################# void Gamma_Set(void) ####################//
	lld_lcdWriteReg(0x30,0x0000);		
	lld_lcdWriteReg(0x31,0x0502);		
	lld_lcdWriteReg(0x32,0x0307);		
	lld_lcdWriteReg(0x33,0x0305);		
	lld_lcdWriteReg(0x34,0x0004);		
	lld_lcdWriteReg(0x35,0x0402);		
	lld_lcdWriteReg(0x36,0x0707);		
	lld_lcdWriteReg(0x37,0x0503);		
	lld_lcdWriteReg(0x38,0x1505);		
	lld_lcdWriteReg(0x39,0x1505);
	lld_lcdDelay(10);

	//################## void Display_ON(void) ####################//
	lld_lcdWriteReg(0x0007,0x0001);
	lld_lcdDelay(10);
	lld_lcdWriteReg(0x0007,0x0021);
	lld_lcdWriteReg(0x0007,0x0023);
	lld_lcdDelay(10);
	lld_lcdWriteReg(0x0007,0x0033);
	lld_lcdDelay(10);
	lld_lcdWriteReg(0x0007,0x0133);

	// chinese code ends here

	// Turn on the backlight
	gdisp_lld_backlight(GDISP_INITIAL_BACKLIGHT);
	
    /* Initialise the GDISP structure */
    GDISP.Width = GDISP_SCREEN_WIDTH;
    GDISP.Height = GDISP_SCREEN_HEIGHT;
    GDISP.Orientation = GDISP_ROTATE_0;
    GDISP.Powermode = powerOn;
    GDISP.Backlight = GDISP_INITIAL_BACKLIGHT;
    GDISP.Contrast = GDISP_INITIAL_CONTRAST;
    #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
	GDISP.clipx0 = 0;
	GDISP.clipy0 = 0;
	GDISP.clipx1 = GDISP.Width;
	GDISP.clipy1 = GDISP.Height;
    #endif

	return TRUE;
}
示例#2
0
文件: gdisp_lld.c 项目: bunnie/uGFX
bool_t gdisp_lld_init(void) {
	/* Initialise your display */
	gdisp_lld_init_board();

	/* Hardware reset */
	gdisp_lld_reset_pin(TRUE);
	lld_lcdDelay(1000);
	gdisp_lld_reset_pin(FALSE);
	lld_lcdDelay(1000);

    DISPLAY_CODE = lld_lcdReadReg(0);
    lld_lcdWriteReg(0x0000, 0x0001); //start Int. osc
    lld_lcdDelay(500);
    lld_lcdWriteReg(0x0001, 0x0100); //Set SS bit (shift direction of outputs is from S720 to S1)
    lld_lcdWriteReg(0x0002, 0x0700); //select  the line inversion
    lld_lcdWriteReg(0x0003, 0x1038); //Entry mode(Horizontal : increment,Vertical : increment, AM=1)
    lld_lcdWriteReg(0x0004, 0x0000); //Resize control(No resizing)
    lld_lcdWriteReg(0x0008, 0x0202); //front and back porch 2 lines
    lld_lcdWriteReg(0x0009, 0x0000); //select normal scan
    lld_lcdWriteReg(0x000A, 0x0000); //display control 4
    lld_lcdWriteReg(0x000C, 0x0000); //system interface(2 transfer /pixel), internal sys clock,     
    lld_lcdWriteReg(0x000D, 0x0000); //Frame marker position
    lld_lcdWriteReg(0x000F, 0x0000); //selects clk, enable and sync signal polarity,
    lld_lcdWriteReg(0x0010, 0x0000); //  
    lld_lcdWriteReg(0x0011, 0x0000); //power control 2 reference voltages = 1:1,
    lld_lcdWriteReg(0x0012, 0x0000); //power control 3 VRH
    lld_lcdWriteReg(0x0013, 0x0000); //power control 4 VCOM amplitude
    lld_lcdDelay(500);
    lld_lcdWriteReg(0x0010, 0x17B0); //power control 1 BT,AP
    lld_lcdWriteReg(0x0011, 0x0137); //power control 2 DC,VC
    lld_lcdDelay(500);
    lld_lcdWriteReg(0x0012, 0x0139); //power control 3 VRH
    lld_lcdDelay(500);
    lld_lcdWriteReg(0x0013, 0x1d00); //power control 4 vcom amplitude
    lld_lcdWriteReg(0x0029, 0x0011); //power control 7 VCOMH
    lld_lcdDelay(500);
    lld_lcdWriteReg(0x0030, 0x0007);
    lld_lcdWriteReg(0x0031, 0x0403);
    lld_lcdWriteReg(0x0032, 0x0404);
    lld_lcdWriteReg(0x0035, 0x0002);
    lld_lcdWriteReg(0x0036, 0x0707);
    lld_lcdWriteReg(0x0037, 0x0606);
    lld_lcdWriteReg(0x0038, 0x0106);
    lld_lcdWriteReg(0x0039, 0x0007);
    lld_lcdWriteReg(0x003c, 0x0700);
    lld_lcdWriteReg(0x003d, 0x0707);
    lld_lcdWriteReg(0x0020, 0x0000); //starting Horizontal GRAM Address
    lld_lcdWriteReg(0x0021, 0x0000); //starting Vertical GRAM Address
    lld_lcdWriteReg(0x0050, 0x0000); //Horizontal GRAM Start Position
    lld_lcdWriteReg(0x0051, 0x00EF); //Horizontal GRAM end Position
    lld_lcdWriteReg(0x0052, 0x0000); //Vertical GRAM Start Position
    lld_lcdWriteReg(0x0053, 0x013F); //Vertical GRAM end Position
	switch (DISPLAY_CODE) {   
		case 0x9320:
        	lld_lcdWriteReg(0x0060, 0x2700); //starts scanning from G1, and 320 drive lines
        	break;
      	case 0x9325:
     		lld_lcdWriteReg(0x0060, 0xA700); //starts scanning from G1, and 320 drive lines
			break;
	}

    lld_lcdWriteReg(0x0061, 0x0001); //fixed base display
    lld_lcdWriteReg(0x006a, 0x0000); //no scroll
    lld_lcdWriteReg(0x0090, 0x0010); //set Clocks/Line =16, Internal Operation Clock Frequency=fosc/1,
    lld_lcdWriteReg(0x0092, 0x0000); //set gate output non-overlap period=0
    lld_lcdWriteReg(0x0093, 0x0003); //set Source Output Position=3
    lld_lcdWriteReg(0x0095, 0x0110); //RGB interface(Clocks per line period=16 clocks)
    lld_lcdWriteReg(0x0097, 0x0110); //set Gate Non-overlap Period 0 locksc
    lld_lcdWriteReg(0x0098, 0x0110); //
    lld_lcdWriteReg(0x0007, 0x0173); //display On

	// Turn on the backlight
	gdisp_lld_backlight(GDISP_INITIAL_BACKLIGHT);
	
    /* Initialise the GDISP structure */
    GDISP.Width = GDISP_SCREEN_WIDTH;
    GDISP.Height = GDISP_SCREEN_HEIGHT;
    GDISP.Orientation = GDISP_ROTATE_0;
    GDISP.Powermode = powerOn;
    GDISP.Backlight = GDISP_INITIAL_BACKLIGHT;
    GDISP.Contrast = GDISP_INITIAL_CONTRAST;
    #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
	GDISP.clipx0 = 0;
	GDISP.clipy0 = 0;
	GDISP.clipx1 = GDISP.Width;
	GDISP.clipy1 = GDISP.Height;
    #endif

	return TRUE;
}