LLDSPEC void gdisp_lld_control(GDisplay *g) {
		switch(g->p.x) {
		case GDISP_CONTROL_POWER:
			if (g->g.Powermode == (powermode_t)g->p.ptr)
				return;
			switch((powermode_t)g->p.ptr) {
				case powerOff:
					acquire_bus(g);
					write_reg(g, 0x07, 0x0000);
					write_reg(g, 0x10, 0x0000);
					write_reg(g, 0x11, 0x0000);
					write_reg(g, 0x12, 0x0000);
					write_reg(g, 0x13, 0x0000);
					release_bus(g);

					set_backlight(g, 0);
					break;

				case powerOn:
					//*************Power On sequence ******************//
					acquire_bus(g);
					write_reg(g, 0x10, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
					write_reg(g, 0x11, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
					write_reg(g, 0x12, 0x0000); /* VREG1OUT voltage */
					write_reg(g, 0x13, 0x0000); /* VDV[4:0] for VCOM amplitude */
					gfxSleepMicroseconds(2000);            /* Dis-charge capacitor power voltage */
					write_reg(g, 0x10, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
					write_reg(g, 0x11, 0x0147); /* DC1[2:0], DC0[2:0], VC[2:0] */
					gfxSleepMicroseconds(500);
					write_reg(g, 0x12, 0x013C); /* VREG1OUT voltage */
					gfxSleepMicroseconds(500);
					write_reg(g, 0x13, 0x0E00); /* VDV[4:0] for VCOM amplitude */
					write_reg(g, 0x29, 0x0009); /* VCM[4:0] for VCOMH */
					gfxSleepMicroseconds(500);
					write_reg(g, 0x07, 0x0173); /* 262K color and display ON */
					release_bus(g);

					set_backlight(g, g->g.Backlight);
					break;

				case powerSleep:
					acquire_bus(g);
					write_reg(g, 0x07, 0x0000); /* display OFF */
					write_reg(g, 0x10, 0x0000); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
					write_reg(g, 0x11, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
					write_reg(g, 0x12, 0x0000); /* VREG1OUT voltage */
					write_reg(g, 0x13, 0x0000); /* VDV[4:0] for VCOM amplitude */
					gfxSleepMicroseconds(2000); /* Dis-charge capacitor power voltage */
					write_reg(g, 0x10, 0x0002); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
					release_bus(g);

					set_backlight(g, 0);
					break;

				case powerDeepSleep:
					acquire_bus(g);
					write_reg(g, 0x07, 0x0000); /* display OFF */
					write_reg(g, 0x10, 0x0000); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
					write_reg(g, 0x11, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
					write_reg(g, 0x12, 0x0000); /* VREG1OUT voltage */
					write_reg(g, 0x13, 0x0000); /* VDV[4:0] for VCOM amplitude */
					gfxSleepMicroseconds(2000); /* Dis-charge capacitor power voltage */
					write_reg(g, 0x10, 0x0004); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
					release_bus(g);

					set_backlight(g, 0);
					break;

				default:
					return;
				}
				g->g.Powermode = (powermode_t)g->p.ptr;
				return;

			case GDISP_CONTROL_ORIENTATION:
				if (g->g.Orientation == (orientation_t)g->p.ptr)
					return;
				switch((orientation_t)g->p.ptr) {
				case GDISP_ROTATE_0:
					acquire_bus(g);
					write_reg(g, 0x01, 0x0100);
					write_reg(g, 0x03, 0x1038);
					write_reg(g, 0x60, 0x2700);
					release_bus(g);

					g->g.Height = GDISP_SCREEN_HEIGHT;
					g->g.Width = GDISP_SCREEN_WIDTH;
					break;

				case GDISP_ROTATE_90:
					acquire_bus(g);
					write_reg(g, 0x01, 0x0000);
					write_reg(g, 0x03, 0x1030);
					write_reg(g, 0x60, 0x2700);
					release_bus(g);

					g->g.Height = GDISP_SCREEN_WIDTH;
					g->g.Width = GDISP_SCREEN_HEIGHT;
					break;

				case GDISP_ROTATE_180:
					acquire_bus(g);
					write_reg(g, 0x01, 0x0000);
					write_reg(g, 0x03, 0x1030);
					write_reg(g, 0x60, 0x2700);
					release_bus(g);

					g->g.Height = GDISP_SCREEN_HEIGHT;
					g->g.Width = GDISP_SCREEN_WIDTH;
					break;

				case GDISP_ROTATE_270:
					acquire_bus(g);
					write_reg(g, 0x01, 0x0100);
					write_reg(g, 0x03, 0x1038);
					write_reg(g, 0x60, 0xA700);
					release_bus(g);

					g->g.Height = GDISP_SCREEN_WIDTH;
					g->g.Width = GDISP_SCREEN_HEIGHT;
					break;
		
				default:
					return;
				}
				g->g.Orientation = (orientation_t)g->p.ptr;
				return;

	        case GDISP_CONTROL_BACKLIGHT:
	            if ((unsigned)g->p.ptr > 100)
	            	g->p.ptr = (void *)100;
	            set_backlight(g, (unsigned)g->p.ptr);
	            g->g.Backlight = (unsigned)g->p.ptr;
	            return;
			default:
				return;
		}
	}
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
	uint16_t cver;

	// No private area for this controller
	g->priv = 0;

	// Initialise the board interface
	init_board(g);

	/* Hardware reset */
	setpin_reset(g, TRUE);
	gfxSleepMicroseconds(1000);
	setpin_reset(g, FALSE);
	gfxSleepMicroseconds(1000);

	acquire_bus(g);
	write_index(g, 0);				// Get controller version
	setreadmode(g);
	dummy_read(g);
	cver = read_data(g);
	setwritemode(g);

	/* initializing funciton */   
		write_reg(g, 0xe5,0x8000);  /* Set the internal vcore voltage */   
		write_reg(g, 0x00,0x0001);  /* start OSC */   
		write_reg(g, 0x2b,0x0010);  /* Set the frame rate as 80 when the internal resistor is used for oscillator circuit */   
		write_reg(g, 0x01,0x0100);  /* s720  to  s1 ; G1 to G320 */   
		write_reg(g, 0x02,0x0700);  /* set the line inversion */   
		write_reg(g, 0x03,0x1018);  /* 65536 colors */    
		write_reg(g, 0x04,0x0000);   
		write_reg(g, 0x08,0x0202);  /* specify the line number of front and back porch periods respectively */   
		write_reg(g, 0x09,0x0000);   
		write_reg(g, 0x0a,0x0000);   
		write_reg(g, 0x0c,0x0000);  /* select  internal system clock */  
		write_reg(g, 0x0d,0x0000);   
		write_reg(g, 0x0f,0x0000);    
		write_reg(g, 0x50,0x0000);  /* set windows adress */   
		write_reg(g, 0x51,0x00ef);   
		write_reg(g, 0x52,0x0000);   
		write_reg(g, 0x53,0x013f);   
		write_reg(g, 0x60,0x2700);   
		write_reg(g, 0x61,0x0001);   
		write_reg(g, 0x6a,0x0000);   
		write_reg(g, 0x80,0x0000);   
		write_reg(g, 0x81,0x0000);   
		write_reg(g, 0x82,0x0000);   
		write_reg(g, 0x83,0x0000);   
		write_reg(g, 0x84,0x0000);   
		write_reg(g, 0x85,0x0000);   
		write_reg(g, 0x90,0x0010);   
		write_reg(g, 0x92,0x0000);   
		write_reg(g, 0x93,0x0003);   
		write_reg(g, 0x95,0x0110);   
		write_reg(g, 0x97,0x0000);   
		write_reg(g, 0x98,0x0000);    
		/* power setting function */   
		write_reg(g, 0x10,0x0000);   
		write_reg(g, 0x11,0x0000);   
		write_reg(g, 0x12,0x0000);   
		write_reg(g, 0x13,0x0000);   
		gfxSleepMicroseconds(100);   
		write_reg(g, 0x10,0x17b0);   
		write_reg(g, 0x11,0x0004);   
		gfxSleepMicroseconds(50);   
		write_reg(g, 0x12,0x013e);   
		gfxSleepMicroseconds(50);   
		write_reg(g, 0x13,0x1f00);   
		write_reg(g, 0x29,0x000f);   
		gfxSleepMicroseconds(50);   
		write_reg(g, 0x20,0x0000);   
		write_reg(g, 0x21,0x0000);   
		
		/* initializing function */  	
		write_reg(g, 0x30,0x0204);   
		write_reg(g, 0x31,0x0001);   
		write_reg(g, 0x32,0x0000);   
		write_reg(g, 0x35,0x0206);   
		write_reg(g, 0x36,0x0600);   
		write_reg(g, 0x37,0x0500);   
		write_reg(g, 0x38,0x0505);   
		write_reg(g, 0x39,0x0407);   
		write_reg(g, 0x3c,0x0500);   
		write_reg(g, 0x3d,0x0503);   
		
		/* display on */  
		write_reg(g, 0x07,0x0173);

		gfxSleepMicroseconds(50);

    // Finish Init
    post_init_board(g);

  	// Release the bus
 	release_bus(g);

	// Turn on the backlight
	set_backlight(g, GDISP_INITIAL_BACKLIGHT);
	
    /* Initialise the GDISP structure */
    g->g.Width = GDISP_SCREEN_WIDTH;
    g->g.Height = GDISP_SCREEN_HEIGHT;
    g->g.Orientation = GDISP_ROTATE_0;
    g->g.Powermode = powerOn;
    g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
    g->g.Contrast = GDISP_INITIAL_CONTRAST;
	return TRUE;
}
LLDSPEC bool_t gdisp_lld_init(GDisplay* g) {
	// no private area for this controller
	g->priv = 0;

	// initialise the board interface
	init_board(g);

	// Hardware reset
	setpin_reset(g, TRUE);
	gfxSleepMilliseconds(20);
	setpin_reset(g, FALSE);
	gfxSleepMilliseconds(20);

	// Get the bus for the following initialisation commands
	acquire_bus(g);

	// Enter sleep mode (if we are not already there).
	write_reg(g, SSD2119_REG_SLEEP_MODE_1, 0x0001);
	gfxSleepMicroseconds(5);

	// Set initial power parameters.
	write_reg(g, SSD2119_REG_PWR_CTRL_5, 0x00B2);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_VCOM_OTP_1, 0x0006);
	gfxSleepMicroseconds(5);

	// Start the oscillator.
	write_reg(g, SSD2119_REG_OSC_START, 0x0001);
	gfxSleepMicroseconds(5);

	// Set pixel format and basic display orientation (scanning direction).
	write_reg(g, SSD2119_REG_OUTPUT_CTRL, 0x30EF);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_LCD_DRIVE_AC_CTRL, 0x0600);
	gfxSleepMicroseconds(5);

	// Exit sleep mode.
	write_reg(g, SSD2119_REG_SLEEP_MODE_1, 0x0000);
	gfxSleepMicroseconds(5);

	// Configure pixel color format and MCU interface parameters.
	write_reg(g, SSD2119_REG_ENTRY_MODE, 0x6830); // ENTRY_MODE_DEFAULT
	gfxSleepMicroseconds(5);

	// Set analog parameters.
	write_reg(g, SSD2119_REG_SLEEP_MODE_2, 0x0999);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_ANALOG_SET, 0x3800);
	gfxSleepMicroseconds(5);

	// Enable the display.
	write_reg(g, SSD2119_REG_DISPLAY_CTRL, 0x0033);
	gfxSleepMicroseconds(5);

	// Set VCIX2 voltage to 6.1V.
	write_reg(g, SSD2119_REG_PWR_CTRL_2, 0x0005);
	gfxSleepMicroseconds(5);

	// Configure gamma correction.
	write_reg(g, SSD2119_REG_GAMMA_CTRL_1, 0x0000);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_GAMMA_CTRL_2, 0x0303);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_GAMMA_CTRL_3, 0x0407);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_GAMMA_CTRL_4, 0x0301);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_GAMMA_CTRL_5, 0x0301);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_GAMMA_CTRL_6, 0x0403);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_GAMMA_CTRL_7, 0x0707);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_GAMMA_CTRL_8, 0x0400);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_GAMMA_CTRL_9, 0x0a00);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_GAMMA_CTRL_10, 0x1000);
	gfxSleepMicroseconds(5);

	// Configure Vlcd63 and VCOMl.
	write_reg(g, SSD2119_REG_PWR_CTRL_3, 0x000A);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_PWR_CTRL_4, 0x2E00);
	gfxSleepMicroseconds(5);

	// Set the display size and ensure that the GRAM window is set to allow access to the full display buffer.
	write_reg(g, SSD2119_REG_V_RAM_POS, (GDISP_SCREEN_HEIGHT - 1) << 8);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_H_RAM_START, 0x0000);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_H_RAM_END, GDISP_SCREEN_WIDTH - 1);
	gfxSleepMicroseconds(5);

	write_reg(g, SSD2119_REG_X_RAM_ADDR, 0x00);
	gfxSleepMicroseconds(5);
	write_reg(g, SSD2119_REG_Y_RAM_ADDR, 0x00);
	gfxSleepMicroseconds(5);

    // Finish Init
    post_init_board(g);

 	// Release the bus
	release_bus(g);

	/* Turn on the back-light */
	set_backlight(g, GDISP_INITIAL_BACKLIGHT);

	/* Initialise the GDISP structure */
	g->g.Width = GDISP_SCREEN_WIDTH;
	g->g.Height = GDISP_SCREEN_HEIGHT;
	g->g.Orientation = GDISP_ROTATE_0;
	g->g.Powermode = powerOn;
	g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
	g->g.Contrast = GDISP_INITIAL_CONTRAST;
	return TRUE;
}
	LLDSPEC void gdisp_lld_control(GDisplay *g) {
		switch(g->p.x) {
		case GDISP_CONTROL_POWER:
			if (g->g.Powermode == (powermode_t)g->p.ptr)
				return;
			switch((powermode_t)g->p.ptr) {
			case powerOff:
			case powerDeepSleep:
				acquire_bus(g);
				write_reg(g, SSD2119_REG_SLEEP_MODE_1,	0x0001);	// Enter sleep mode
				write_reg(g, SSD2119_REG_SLEEP_MODE_2, 0x2999);		// Enable deep sleep function
				write_reg(g, SSD2119_REG_DISPLAY_CTRL,	0x0000);	// Display off
				if ((powermode_t)g->p.ptr == powerOff)
					write_reg(g, SSD2119_REG_OSC_START,	0x0000);	// Turn off oscillator
				release_bus(g);
				set_backlight(g, 0);
				break;
			case powerSleep:
				acquire_bus(g);
				write_reg(g, SSD2119_REG_SLEEP_MODE_1, 0x0001);		// Enter sleep mode
				write_reg(g, SSD2119_REG_DISPLAY_CTRL, 0x0000);		// Display off
				release_bus(g);
				set_backlight(g, 0);
				break;
			case powerOn:
				acquire_bus(g);
				if (g->g.Powermode == powerOff) {
					write_reg(g, SSD2119_REG_OSC_START, 0x0001);	// Start the oscillator
					gfxSleepMicroseconds(5);
					write_reg(g, SSD2119_REG_SLEEP_MODE_2, 0x0999);	// Disable deep sleep function
				} else if (g->g.Powermode == powerDeepSleep)
					write_reg(g, SSD2119_REG_SLEEP_MODE_2, 0x0999);	// Disable deep sleep function
				write_reg(g, SSD2119_REG_SLEEP_MODE_1, 0x0000);		// Leave sleep mode
				write_reg(g, SSD2119_REG_DISPLAY_CTRL, 0x0033);		// Display on
				release_bus(g);
				gfxSleepMicroseconds(25);
				set_backlight(g, g->g.Backlight);
				break;
			default:
				return;
			}
			g->g.Powermode = (powermode_t)g->p.ptr;
			return;

		case GDISP_CONTROL_ORIENTATION:
			if (g->g.Orientation == (orientation_t)g->p.ptr)
				return;
			switch((orientation_t)g->p.ptr) {
			case GDISP_ROTATE_0:
				acquire_bus(g);
				/* ID = 11 AM = 0 */
				write_reg(g, SSD2119_REG_ENTRY_MODE, 0x6830);
				release_bus(g);
				g->g.Height = GDISP_SCREEN_HEIGHT;
				g->g.Width = GDISP_SCREEN_WIDTH;
				break;
			case GDISP_ROTATE_90:
				acquire_bus(g);
				/* ID = 01 AM = 1 */
				write_reg(g, SSD2119_REG_ENTRY_MODE, 0x6818);
				release_bus(g);
				g->g.Height = GDISP_SCREEN_WIDTH;
				g->g.Width = GDISP_SCREEN_HEIGHT;
				break;
			case GDISP_ROTATE_180:
				acquire_bus(g);
				/* ID = 00 AM = 0 */
				write_reg(g, SSD2119_REG_ENTRY_MODE, 0x6800);
				release_bus(g);
				g->g.Height = GDISP_SCREEN_HEIGHT;
				g->g.Width = GDISP_SCREEN_WIDTH;
				break;
			case GDISP_ROTATE_270:
				acquire_bus(g);
				/* ID = 10 AM = 1 */
				write_reg(g, SSD2119_REG_ENTRY_MODE, 0x6828);
				release_bus(g);
				g->g.Height = GDISP_SCREEN_WIDTH;
				g->g.Width = GDISP_SCREEN_HEIGHT;
				break;
			default:
				return;
			}
			g->g.Orientation = (orientation_t)g->p.ptr;
			return;

        case GDISP_CONTROL_BACKLIGHT:
            if ((unsigned)g->p.ptr > 100)
            	g->p.ptr = (void *)100;
            set_backlight(g, (unsigned)g->p.ptr);
            g->g.Backlight = (unsigned)g->p.ptr;
            return;

		//case GDISP_CONTROL_CONTRAST:
        default:
            return;
		}
	}
Exemple #5
0
	LLDSPEC void gdisp_lld_control(GDisplay *g) {
		switch(g->p.x) {
		case GDISP_CONTROL_POWER:
			if (g->g.Powermode == (powermode_t)g->p.ptr)
				return;
			switch((powermode_t)g->p.ptr) {
			case powerOff:
				acquire_bus(g);
				write_reg(g, 0x10, 0x0000);	// leave sleep mode
				write_reg(g, 0x07, 0x0000);	// halt operation
				write_reg(g, 0x00, 0x0000);	// turn off oscillator
				write_reg(g, 0x10, 0x0001);	// enter sleep mode
				release_bus(g);
				break;
			case powerOn:
				acquire_bus(g);
				write_reg(g, 0x10, 0x0000);	// leave sleep mode
				write_reg(g, 0x00, 0x0001);	// turn on oscillator
				gfxSleepMicroseconds(5);
				release_bus(g);
				break;
			case powerSleep:
				acquire_bus(g);
				write_reg(g, 0x10, 0x0001);	// enter sleep mode
				release_bus(g);
				break;
			default:
				return;
			}
			g->g.Powermode = (powermode_t)g->p.ptr;
			return;

		case GDISP_CONTROL_ORIENTATION:
			if (g->g.Orientation == (orientation_t)g->p.ptr)
				return;
			switch((orientation_t)g->p.ptr) {
			case GDISP_ROTATE_0:
				acquire_bus(g);
				/* ID = 11 AM = 0 */
				write_reg(g, 0x11, 0x6070);
				release_bus(g);
				g->g.Height = GDISP_SCREEN_HEIGHT;
				g->g.Width = GDISP_SCREEN_WIDTH;
				break;
			case GDISP_ROTATE_90:
				acquire_bus(g);
				/* ID = 01 AM = 1 */
				write_reg(g, 0x11, 0x6058);
				release_bus(g);
				g->g.Height = GDISP_SCREEN_WIDTH;
				g->g.Width = GDISP_SCREEN_HEIGHT;
				break;
			case GDISP_ROTATE_180:
				acquire_bus(g);
				/* ID = 00 AM = 0 */
				write_reg(g, 0x11, 0x6040);
				release_bus(g);
				g->g.Height = GDISP_SCREEN_HEIGHT;
				g->g.Width = GDISP_SCREEN_WIDTH;
				break;
			case GDISP_ROTATE_270:
				acquire_bus(g);
				/* ID = 10 AM = 1 */
				write_reg(g, 0x11, 0x6068);
				release_bus(g);
				g->g.Height = GDISP_SCREEN_WIDTH;
				g->g.Width = GDISP_SCREEN_HEIGHT;
				break;
			default:
				return;
			}
			g->g.Orientation = (orientation_t)g->p.ptr;
			return;

        case GDISP_CONTROL_BACKLIGHT:
            if ((unsigned)g->p.ptr > 100)
            	g->p.ptr = (void *)100;
            set_backlight(g, (unsigned)g->p.ptr);
            g->g.Backlight = (unsigned)g->p.ptr;
            return;

		//case GDISP_CONTROL_CONTRAST:
        default:
            return;
		}
	}
Exemple #6
0
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
	// No private area for this controller
	g->priv = 0;

	// Initialise the board interface
	init_board(g);

	// Hardware reset
	setpin_reset(g, TRUE);
	gfxSleepMilliseconds(20);
	setpin_reset(g, FALSE);
	gfxSleepMilliseconds(20);

	// Get the bus for the following initialisation commands
	acquire_bus(g);
	
	write_reg(g, 0x00, 0x0001);		gfxSleepMicroseconds(5);
	write_reg(g, 0x03, 0xA8A4);    	gfxSleepMicroseconds(5);
	write_reg(g, 0x0C, 0x0000);    	gfxSleepMicroseconds(5);
	write_reg(g, 0x0D, 0x080C);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x0E, 0x2B00);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x1E, 0x00B0);    	gfxSleepMicroseconds(5);
	write_reg(g, 0x01, 0x2B3F);		gfxSleepMicroseconds(5);
    write_reg(g, 0x02, 0x0600);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x10, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x11, 0x6070);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x05, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x06, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x16, 0xEF1C);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x17, 0x0003);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x07, 0x0133);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x0B, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x0F, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x41, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x42, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x48, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x49, 0x013F);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x4A, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x4B, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x44, 0xEF00);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x45, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x46, 0x013F);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x30, 0x0707);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x31, 0x0204);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x32, 0x0204);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x33, 0x0502);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x34, 0x0507);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x35, 0x0204);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x36, 0x0204);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x37, 0x0502);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x3A, 0x0302);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x3B, 0x0302);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x23, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x24, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x25, 0x8000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x4f, 0x0000);		gfxSleepMicroseconds(5);
    write_reg(g, 0x4e, 0x0000);		gfxSleepMicroseconds(5);

    // Finish Init
    post_init_board(g);

 	// Release the bus
	release_bus(g);
	
	/* Turn on the back-light */
	set_backlight(g, GDISP_INITIAL_BACKLIGHT);

	/* Initialise the GDISP structure */
	g->g.Width = GDISP_SCREEN_WIDTH;
	g->g.Height = GDISP_SCREEN_HEIGHT;
	g->g.Orientation = GDISP_ROTATE_0;
	g->g.Powermode = powerOn;
	g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
	g->g.Contrast = GDISP_INITIAL_CONTRAST;
	return TRUE;
}
Exemple #7
0
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
	uint16_t i = 0, f = 0;
	// No private area for this controller
	g->priv = 0;

	// Initialise the board interface
	init_board(g);

	// Hardware reset
	setpin_reset(g, TRUE);
	gfxSleepMilliseconds(120);
	setpin_reset(g, FALSE);
	gfxSleepMilliseconds(120);

	// Get the bus for the following initialisation commands
	acquire_bus(g);

	write_reg(g, 0x01, 0x0100);		gfxSleepMicroseconds(5);
	write_reg(g, 0x02, 0x0700);    	gfxSleepMicroseconds(5);
	write_reg(g, 0x03, 0x1030);    	gfxSleepMicroseconds(5);
	write_reg(g, 0x04, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x08, 0x0302);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x09, 0x0000);    	gfxSleepMicroseconds(5);
	write_reg(g, 0x0A, 0x0008);		gfxSleepMicroseconds(5);
    write_reg(g, 0x0C, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x0D, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x0F, 0x6070);    	gfxSleepMicroseconds(5);

	gfxSleepMilliseconds(100);

  	//*******POWER CONTROL REGISTER INITIAL*******//
    write_reg(g, 0x10, 0x0790);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x11, 0x0005);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x12, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x13, 0x0000);    	gfxSleepMicroseconds(5);

	gfxSleepMilliseconds(50);

  	//********POWER SUPPPLY STARTUP 1 SETTING*******//
    write_reg(g, 0x10, 0x12B0);    	gfxSleepMicroseconds(5);
	gfxSleepMilliseconds(50);
    write_reg(g, 0x11, 0x0007);    	gfxSleepMicroseconds(5);
	gfxSleepMilliseconds(50);

  	//********POWER SUPPLY STARTUP 2 SETTING******//
    write_reg(g, 0x12, 0x008C);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x13, 0x1700);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x29, 0x0022);    	gfxSleepMicroseconds(5);

	gfxSleepMilliseconds(50);

  	//******GAMMA CLUSTER SETTING******//
    write_reg(g, 0x30, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x31, 0x0505);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x32, 0x0205);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x35, 0x0206);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x36, 0x0408);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x37, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x38, 0x0504);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x39, 0x0206);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x3C, 0x0206);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x3D, 0x0408);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x20, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x21, 0x0000);    	gfxSleepMicroseconds(5);

  	// -----------DISPLAY WINDOWS 240*320-------------//
    write_reg(g, 0x50, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x51, 0x00EF);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x52, 0x0000);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x53, 0x013F);    	gfxSleepMicroseconds(5); 	//RTNI setting

	gfxSleepMilliseconds(50);

  	//-----FRAME RATE SETTING-------//
    write_reg(g, 0x60, 0xA700);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x61, 0x0001);    	gfxSleepMicroseconds(5);
    write_reg(g, 0x90, 0x0033);    	gfxSleepMicroseconds(5);

  	//-------DISPLAY ON------//
    write_reg(g, 0x07, 0x0133);    	gfxSleepMicroseconds(5);

	gfxSleepMilliseconds(50);

	// -------EXIT STANDBY----//
    write_reg(g, 0x10, 0x14E0);    	gfxSleepMicroseconds(5);
	gfxSleepMilliseconds(100);
    write_reg(g, 0x07, 0x0133);    	gfxSleepMicroseconds(5);

    //  ------Start Write Data To RAM-----//
    write_index(g, 0x0022);
    //paint screen black
    for(i=0;i<2;i++)
    {
    	for(f=0;f<38400;f++)
    	{
    		write_data(g, 0xFFFF);
    	}
    }

    // Finish Init
    post_init_board(g);

 	// Release the bus
	release_bus(g);
	
	/* Turn on the back-light */
	set_backlight(g, GDISP_INITIAL_BACKLIGHT);

	/* Initialise the GDISP structure */
	g->g.Width = GDISP_SCREEN_WIDTH;
	g->g.Height = GDISP_SCREEN_HEIGHT;
	g->g.Orientation = GDISP_ROTATE_0;
	g->g.Powermode = powerOn;
	g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
	g->g.Contrast = GDISP_INITIAL_CONTRAST;
	return TRUE;
}
Exemple #8
0
/*===========================================================================*/
static inline void lld_lcdDelay(uint16_t us) {
	gfxSleepMicroseconds(us);
}
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
	uint16_t cver;

	// No private area for this controller
	g->priv = 0;

	// Initialise the board interface
	init_board(g);

	/* Hardware reset */
	setpin_reset(g, TRUE);
	gfxSleepMicroseconds(1000);
	setpin_reset(g, FALSE);
	gfxSleepMicroseconds(1000);

	acquire_bus(g);
	write_index(g, 0);				// Get controller version
	setreadmode(g);
	dummy_read(g);
    cver = read_data(g);
    setwritemode(g);

	// chinese code starts here
	write_reg(g, 0x00, 0x0001);
	gfxSleepMilliseconds(10);

	write_reg(g, 0x15, 0x0030);
	write_reg(g, 0x11, 0x0040);
	write_reg(g, 0x10, 0x1628);
	write_reg(g, 0x12, 0x0000);
	write_reg(g, 0x13, 0x104d);
	gfxSleepMilliseconds(10);
	write_reg(g, 0x12, 0x0010);
	gfxSleepMilliseconds(10);
	write_reg(g, 0x10, 0x2620);
	write_reg(g, 0x13, 0x344d); //304d
	gfxSleepMilliseconds(10);

	write_reg(g, 0x01, 0x0100);
	write_reg(g, 0x02, 0x0300);
	write_reg(g, 0x03, 0x1038);//0x1030
	write_reg(g, 0x08, 0x0604);
	write_reg(g, 0x09, 0x0000);
	write_reg(g, 0x0A, 0x0008);

	write_reg(g, 0x41, 0x0002);
	write_reg(g, 0x60, 0x2700);
	write_reg(g, 0x61, 0x0001);
	write_reg(g, 0x90, 0x0182);
	write_reg(g, 0x93, 0x0001);
	write_reg(g, 0xa3, 0x0010);
	gfxSleepMilliseconds(10);

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

	//################## void Display_ON(void) ####################//
	write_reg(g, 0x07, 0x0001);
	gfxSleepMilliseconds(10);
	write_reg(g, 0x07, 0x0021);
	write_reg(g, 0x07, 0x0023);
	gfxSleepMilliseconds(10);
	write_reg(g, 0x07, 0x0033);
	gfxSleepMilliseconds(10);
	write_reg(g, 0x07, 0x0133);

	// chinese code ends here

    // Finish Init
    post_init_board(g);

 	// Release the bus
	release_bus(g);

	// Turn on the backlight
	set_backlight(g, GDISP_INITIAL_BACKLIGHT);
	
    /* Initialise the GDISP structure */
    g->g.Width = GDISP_SCREEN_WIDTH;
    g->g.Height = GDISP_SCREEN_HEIGHT;
    g->g.Orientation = GDISP_ROTATE_0;
    g->g.Powermode = powerOn;
    g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
    g->g.Contrast = GDISP_INITIAL_CONTRAST;

	return TRUE;
}