/** * @brief Low level GDISP driver initialization. * * @notapi */ bool_t gdisp_lld_init(void) { // Initialize your display init_board(); // Hardware reset. setpin_reset(TRUE); delay_ms(10); setpin_reset(FALSE); delay_ms(1); write_cmd(ST7565_LCD_BIAS_7); write_cmd(ST7565_ADC_NORMAL); write_cmd(ST7565_COM_SCAN_INC); set_display_start_line(0); set_contrast(32); write_cmd(ST7565_RESISTOR_RATIO | 0x3); // turn on voltage converter (VC=1, VR=0, VF=0) write_cmd(ST7565_POWER_CONTROL | 0x04); delay_ms(50); // turn on voltage regulator (VC=1, VR=1, VF=0) write_cmd(ST7565_POWER_CONTROL | 0x06); delay_ms(50); // turn on voltage follower (VC=1, VR=1, VF=1) write_cmd(ST7565_POWER_CONTROL | 0x07); delay_ms(50); display_on(); write_cmd(ST7565_ALLON_NORMAL); invert_display(0);// Disable Inversion of display. write_cmd(ST7565_RMW); gdisp_lld_display(); // Initialize the GDISP structure GDISP.Width = GDISP_SCREEN_WIDTH; GDISP.Height = GDISP_SCREEN_HEIGHT; GDISP.Orientation = GDISP_ROTATE_0; GDISP.Powermode = powerOn; GDISP.Contrast = 50; #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP GDISP.clipx0 = 0; GDISP.clipy0 = 0; GDISP.clipx1 = GDISP.Width; GDISP.clipy1 = GDISP.Height; #endif 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); delayms(100); setpin_reset(g, FALSE); delayms(100); acquire_bus(g); const uint16_t *list = &lcd_init_list[0]; uint8_t size = sizeof(lcd_init_list) / sizeof(lcd_init_list[0]); while(size--) { write_index(g, *list++); } // Finish Init post_init_board(g); release_bus(g); // Turn on the back-light set_backlight(g, GDISP_INITIAL_BACKLIGHT); // Initialise the GDISP structure to match 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; }
/** * @brief Low level GDISP driver initialization. * * @notapi */ bool_t lld_gdisp_init(void) { /* Initialise your display */ init_board(); // Hardware reset setpin_reset(TRUE); delayms(20); setpin_reset(FALSE); delayms(20); // Get the bus for the following initialisation commands acquire_bus(); write_reg(0x0000,0x0001); delay(5); write_reg(0x0003,0xA8A4); delay(5); write_reg(0x000C,0x0000); delay(5); write_reg(0x000D,0x080C); delay(5); write_reg(0x000E,0x2B00); delay(5); write_reg(0x001E,0x00B0); delay(5); write_reg(0x0001,0x2B3F); delay(5); write_reg(0x0002,0x0600); delay(5); write_reg(0x0010,0x0000); delay(5); write_reg(0x0011,0x6070); delay(5); write_reg(0x0005,0x0000); delay(5); write_reg(0x0006,0x0000); delay(5); write_reg(0x0016,0xEF1C); delay(5); write_reg(0x0017,0x0003); delay(5); write_reg(0x0007,0x0133); delay(5); write_reg(0x000B,0x0000); delay(5); write_reg(0x000F,0x0000); delay(5); write_reg(0x0041,0x0000); delay(5); write_reg(0x0042,0x0000); delay(5); write_reg(0x0048,0x0000); delay(5); write_reg(0x0049,0x013F); delay(5); write_reg(0x004A,0x0000); delay(5); write_reg(0x004B,0x0000); delay(5); write_reg(0x0044,0xEF00); delay(5); write_reg(0x0045,0x0000); delay(5); write_reg(0x0046,0x013F); delay(5); write_reg(0x0030,0x0707); delay(5); write_reg(0x0031,0x0204); delay(5); write_reg(0x0032,0x0204); delay(5); write_reg(0x0033,0x0502); delay(5); write_reg(0x0034,0x0507); delay(5); write_reg(0x0035,0x0204); delay(5); write_reg(0x0036,0x0204); delay(5); write_reg(0x0037,0x0502); delay(5); write_reg(0x003A,0x0302); delay(5); write_reg(0x003B,0x0302); delay(5); write_reg(0x0023,0x0000); delay(5); write_reg(0x0024,0x0000); delay(5); write_reg(0x0025,0x8000); delay(5); write_reg(0x004f,0x0000); delay(5); write_reg(0x004e,0x0000); delay(5); // Release the bus release_bus(); /* Turn on the back-light */ set_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; }
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); // Soft reset write_reg8x2(g, 0x01, 0x01, 0x00); gfxSleepMilliseconds(1); // PLL config write_reg8(g, 0x88, 0x08); gfxSleepMilliseconds(1); write_reg8(g, 0x89, 0x02); gfxSleepMilliseconds(1); write_reg8(g, 0x10, 0x0F); //SYSR bit[4:3]=00 256 color bit[2:1]= 00 8bit MPU interface // 0x0F = 16bit MCU interface and 65k color display write_reg8(g, 0x04, 0x82); gfxSleepMilliseconds(1); //set PCLK inverse // Horizontal set write_reg8(g, 0x14, GDISP_SCREEN_WIDTH/8-1); //HDWR: Horizontal Display Width Setting Bit[6:0] - pixels = (HDWR + 1)*8 write_reg8(g, 0x15, 0x00); //Horizontal Non-Display Period Fine Tuning Option Register (HNDFTR) - HNDFT = [3:0] write_reg8(g, 0x16, 0x01); //HNDR: Horizontal Non-Display Period Bit[4:0] - pixels = (HNDR + 1)*8 write_reg8(g, 0x17, 0x00); //HSTR: HSYNC Start Position[4:0] - Position(PCLK) = (HSTR + 1)*8 write_reg8(g, 0x18, 0x05); //HPWR: HSYNC Polarity, The period width of HSYNC. Width [4:0] width(PCLK) = (HPWR + 1)*8 // Vertical set write_reg16(g, 0x19, GDISP_SCREEN_HEIGHT-1); //VDHR0,1: Vertical Display Height = VDHR + 1 write_reg16(g, 0x1b, 0x0002); //VNDR0,1: Vertical Non-Display Period Bit = (VSTR + 1) write_reg16(g, 0x1d, 0x0007); //VSTR0,1: VSYNC Start Position = (VSTR + 1) write_reg8(g, 0x1f, 0x09); //VPWR: VSYNC Polarity, VSYNC Pulse Width[6:0] - Width(PCLK) = (VPWR + 1) // Active window set write_reg16(g, 0x30, 0); //HSAW0 & HSAW1 write_reg16(g, 0x34, GDISP_SCREEN_WIDTH-1); //HEAW0 & HEAW1 write_reg16(g, 0x32, 0); //VSAW0 & VSAW1 write_reg16(g, 0x36, GDISP_SCREEN_HEIGHT-1); //VEAW0 & VEAW1 // Display ON write_reg8(g, 0x01, 0x80); //PWRR // GPO0 DISP high write_reg8(g, 0x13, 0x01); //GPO // Set initial back-light set_backlight(g, GDISP_INITIAL_BACKLIGHT); // Change timings for faster access post_init_board(g); // Release the bus release_bus(g); /* 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); write_index(g, 0x01); //software reset chThdSleepMilliseconds(5); write_index(g, 0x28); // display off //--------------------------------------------------------- // magic? write_index(g, 0xcf); write_data(g, 0x00); write_data(g, 0x83); write_data(g, 0x30); write_index(g, 0xed); write_data(g, 0x64); write_data(g, 0x03); write_data(g, 0x12); write_data(g, 0x81); write_index(g, 0xe8); write_data(g, 0x85); write_data(g, 0x01); write_data(g, 0x79); write_index(g, 0xcb); write_data(g, 0x39); write_data(g, 0x2c); write_data(g, 0x00); write_data(g, 0x34); write_data(g, 0x02); write_index(g, 0xf7); write_data(g, 0x20); write_index(g, 0xea); write_data(g, 0x00); write_data(g, 0x00); //------------power control------------------------------ write_index(g, 0xc0); //power control write_data(g, 0x26); write_index(g, 0xc1); //power control write_data(g, 0x11); //--------------VCOM write_index(g, 0xc5); //vcom control write_data(g, 0x35);//35 write_data(g, 0x3e);//3E write_index(g, 0xc7); //vcom control write_data(g, 0xbe); // 0x94 //------------memory access control------------------------ write_index(g, 0x36); // memory access control write_data(g, 0x48); //0048 my,mx,mv,ml,BGR,mh,0.0 write_index(g, 0x3a); // pixel format set write_data(g, 0x55);//16bit /pixel //----------------- frame rate------------------------------ write_index(g, 0xb1); // frame rate write_data(g, 0x00); write_data(g, 0x1B); //70 //----------------Gamma--------------------------------- write_index(g, 0xf2); // 3Gamma Function Disable write_data(g, 0x08); write_index(g, 0x26); write_data(g, 0x01); // gamma set 4 gamma curve 01/02/04/08 write_index(g, 0xE0); //positive gamma correction write_data(g, 0x1f); write_data(g, 0x1a); write_data(g, 0x18); write_data(g, 0x0a); write_data(g, 0x0f); write_data(g, 0x06); write_data(g, 0x45); write_data(g, 0x87); write_data(g, 0x32); write_data(g, 0x0a); write_data(g, 0x07); write_data(g, 0x02); write_data(g, 0x07); write_data(g, 0x05); write_data(g, 0x00); write_index(g, 0xE1); //negamma correction write_data(g, 0x00); write_data(g, 0x25); write_data(g, 0x27); write_data(g, 0x05); write_data(g, 0x10); write_data(g, 0x09); write_data(g, 0x3a); write_data(g, 0x78); write_data(g, 0x4d); write_data(g, 0x05); write_data(g, 0x18); write_data(g, 0x0d); write_data(g, 0x38); write_data(g, 0x3a); write_data(g, 0x1f); //--------------ddram --------------------- write_index(g, 0x2a); // column set // size = 239 write_data(g, 0x00); write_data(g, 0x00); write_data(g, 0x00); write_data(g, 0xEF); write_index(g, 0x2b); // page address set // size = 319 write_data(g, 0x00); write_data(g, 0x00); write_data(g, 0x01); write_data(g, 0x3F); // write_index(g, 0x34); //write_index(g, 0x35); // tearing effect off // tearing effect on // write_index(g, 0xb4); // display inversion // write_data(g, 0x00); write_index(g, 0xb7); //entry mode set write_data(g, 0x07); //-----------------display--------------------- write_index(g, 0xb6); // display function control write_data(g, 0x0a); write_data(g, 0x82); write_data(g, 0x27); write_data(g, 0x00); write_index(g, 0x11); //sleep out chThdSleepMilliseconds(100); write_index(g, 0x29); // display on chThdSleepMilliseconds(100); // 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 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); delayms(20); setpin_reset(g, TRUE); delayms(20); /* Get the bus for the following initialisation commands */ acquire_bus(g); write_reg(g, 0x11, 0x2004); write_reg(g, 0x13, 0xCC00); write_reg(g, 0x15, 0x2600); write_reg(g, 0x14, 0x252A); write_reg(g, 0x12, 0x0033); write_reg(g, 0x13, 0xCC04); delayms(1); write_reg(g, 0x13, 0xCC06); delayms(1); write_reg(g, 0x13, 0xCC4F); delayms(1); write_reg(g, 0x13, 0x674F); write_reg(g, 0x11, 0x2003); delayms(1); // Gamma Setting write_reg(g, 0x30, 0x2609); write_reg(g, 0x31, 0x242C); write_reg(g, 0x32, 0x1F23); write_reg(g, 0x33, 0x2425); write_reg(g, 0x34, 0x2226); write_reg(g, 0x35, 0x2523); write_reg(g, 0x36, 0x1C1A); write_reg(g, 0x37, 0x131D); write_reg(g, 0x38, 0x0B11); write_reg(g, 0x39, 0x1210); write_reg(g, 0x3A, 0x1315); write_reg(g, 0x3B, 0x3619); write_reg(g, 0x3C, 0x0D00); write_reg(g, 0x3D, 0x000D); write_reg(g, 0x16, 0x0007); write_reg(g, 0x02, 0x0013); write_reg(g, 0x03, 0x0003); write_reg(g, 0x01, 0x0127); delayms(1); write_reg(g, 0x08, 0x0303); write_reg(g, 0x0A, 0x000B); write_reg(g, 0x0B, 0x0003); write_reg(g, 0x0C, 0x0000); write_reg(g, 0x41, 0x0000); write_reg(g, 0x50, 0x0000); write_reg(g, 0x60, 0x0005); write_reg(g, 0x70, 0x000B); write_reg(g, 0x71, 0x0000); write_reg(g, 0x78, 0x0000); write_reg(g, 0x7A, 0x0000); write_reg(g, 0x79, 0x0007); write_reg(g, 0x07, 0x0051); delayms(1); write_reg(g, 0x07,0x0053); write_reg(g, 0x79,0x0000); // 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 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; }
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 bool_t gdisp_lld_init(GDisplay *g) { LCD_Parameters * lcdp; // The private area for this controller is the LCD timings lcdp = (void *)&DisplayTimings[g->controllerdisplay]; g->priv = lcdp; // 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_index(g, SSD1963_SOFT_RESET); gfxSleepMilliseconds(5); /* Driver PLL config */ write_index(g, SSD1963_SET_PLL_MN); write_data(g, 35); // PLLclk = REFclk (10Mhz) * 36 (360Mhz) write_data(g, 2); // SYSclk = PLLclk / 3 (120MHz) write_data(g, 4); // Apply calculation bit, else it is ignored write_reg(g, SSD1963_SET_PLL, 0x01); // Enable PLL gfxSleepMilliseconds(5); write_reg(g, SSD1963_SET_PLL, 0x03); // Use PLL gfxSleepMilliseconds(5); write_index(g, SSD1963_SOFT_RESET); gfxSleepMilliseconds(5); /* Screen size */ write_index(g, SSD1963_SET_GDISP_MODE); write_data(g, 0x18); //Enabled dithering write_data(g, 0x00); write_data16(g, lcdp->width-1); write_data16(g, lcdp->height-1); write_data(g, 0x00); // RGB write_reg(g, SSD1963_SET_PIXEL_DATA_INTERFACE, SSD1963_PDI_16BIT565); /* LCD Clock specs */ write_index(g, SSD1963_SET_LSHIFT_FREQ); write_data(g, (lcdp->fpr >> 16) & 0xFF); write_data(g, (lcdp->fpr >> 8) & 0xFF); write_data(g, lcdp->fpr & 0xFF); write_index(g, SSD1963_SET_HORI_PERIOD); write_data16(g, lcdp->hperiod); write_data16(g, lcdp->hpulse + lcdp->hbporch); write_data(g, lcdp->hpulse); write_data(g, 0x00); write_data(g, 0x00); write_data(g, 0x00); write_index(g, SSD1963_SET_VERT_PERIOD); write_data16(g, lcdp->vperiod); write_data16(g, lcdp->vpulse + lcdp->vbporch); write_data(g, lcdp->vpulse); write_data(g, 0x00); write_data(g, 0x00); /* Tear effect indicator ON. This is used to tell the host MCU when the driver is not refreshing the panel (during front/back porch) */ write_reg(g, SSD1963_SET_TEAR_ON, 0x00); /* Turn on */ write_index(g, SSD1963_SET_DISPLAY_ON); /* Turn on the back-light */ set_backlight(g, GDISP_INITIAL_BACKLIGHT); // Finish Init post_init_board(g); // Release the bus release_bus(g); /* Initialise the GDISP structure */ g->g.Width = lcdp->width; g->g.Height = lcdp->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); 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; }
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { unsigned char j; // No private area for this controller g->priv = 0; // Initialise the board interface init_board(g); // Hardware reset spiUnselect(&DISP_SPI_PORT); CLR_RS; setpin_reset(g, TRUE); delayms(10); setpin_reset(g, FALSE); delayms(10); SET_RS; spiSelect(&DISP_SPI_PORT); for (j = 0; j < 134; j++) { write_cmd(g, initData[j]); } delayms(10); spiUnselect(&DISP_SPI_PORT); delayms(10); spiSelect(&DISP_SPI_PORT); write_cmd(g, 0xf0); write_cmd(g, 0x81); write_cmd(g, 0xf4); write_cmd(g, 0xb3); write_cmd(g, 0xa0); write_cmd(g, 0xf0); write_cmd(g, 0x06); write_cmd(g, 0x10); write_cmd(g, 0x20); write_cmd(g, 0x30); write_cmd(g, 0xf5); write_cmd(g, 0x0f); write_cmd(g, 0x1c); write_cmd(g, 0x2f); write_cmd(g, 0x34); write_cmd(g, 0xf4); write_cmd(g, 0x94); write_cmd(g, 0xb3); write_cmd(g, 0xa2); write_cmd(g, 0xd0); spiUnselect(&DISP_SPI_PORT); CLR_RS; spiStop(&DISP_SPI_PORT); spiStart(&DISP_SPI_PORT, &spi2cfg2); /* Initialise the GDISP structure to match */ 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) { // The private area is the display surface. g->priv = gfxAlloc(GDISP_SCREEN_HEIGHT/8 * SSD1306_PAGE_WIDTH); // Fill in the prefix command byte on each page line of the display buffer // We can do it during initialisation as this byte is never overwritten. #ifdef SSD1306_PAGE_PREFIX { unsigned i; for(i=0; i < GDISP_SCREEN_HEIGHT/8 * SSD1306_PAGE_WIDTH; i+=SSD1306_PAGE_WIDTH) RAM(g)[i] = SSD1306_PAGE_PREFIX; } #endif // Initialise the board interface init_board(g); // Hardware reset setpin_reset(g, TRUE); gfxSleepMilliseconds(20); setpin_reset(g, FALSE); gfxSleepMilliseconds(20); acquire_bus(g); write_cmd(g, SSD1306_DISPLAYOFF); write_cmd2(g, SSD1306_SETDISPLAYCLOCKDIV, 0x80); write_cmd2(g, SSD1306_SETMULTIPLEX, GDISP_SCREEN_HEIGHT-1); write_cmd2(g, SSD1306_SETPRECHARGE, 0x1F); write_cmd2(g, SSD1306_SETDISPLAYOFFSET, 0); write_cmd(g, SSD1306_SETSTARTLINE | 0); write_cmd2(g, SSD1306_ENABLE_CHARGE_PUMP, 0x14); write_cmd2(g, SSD1306_MEMORYMODE, 0); write_cmd(g, SSD1306_COLSCANDEC); write_cmd(g, SSD1306_ROWSCANDEC); #if GDISP_SCREEN_HEIGHT == 64 write_cmd2(g, SSD1306_SETCOMPINS, 0x12); #else write_cmd2(g, SSD1306_SETCOMPINS, 0x22); #endif write_cmd2(g, SSD1306_SETCONTRAST, (uint8_t)(GDISP_INITIAL_CONTRAST*256/101)); // Set initial contrast. write_cmd2(g, SSD1306_SETVCOMDETECT, 0x10); write_cmd(g, SSD1306_DISPLAYON); write_cmd(g, SSD1306_NORMALDISPLAY); write_cmd3(g, SSD1306_HV_COLUMN_ADDRESS, 0, GDISP_SCREEN_WIDTH-1); write_cmd3(g, SSD1306_HV_PAGE_ADDRESS, 0, GDISP_SCREEN_HEIGHT/8-1); // Finish Init post_init_board(g); // Release the bus release_bus(g); /* 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; }
bool_t GDISP_LLD(init)(void) { /* initialize the hardware */ init_board(); /* Hardware reset */ setpin_reset(TRUE); delayms(20); setpin_reset(TRUE); delayms(20); /* Get the bus for the following initialisation commands */ acquire_bus(); write_reg(0x11,0x2004); write_reg(0x13,0xCC00); write_reg(0x15,0x2600); write_reg(0x14,0x252A); write_reg(0x12,0x0033); write_reg(0x13,0xCC04); delayms(1); write_reg(0x13,0xCC06); delayms(1); write_reg(0x13,0xCC4F); delayms(1); write_reg(0x13,0x674F); write_reg(0x11,0x2003); delayms(1); // Gamma Setting write_reg(0x30,0x2609); write_reg(0x31,0x242C); write_reg(0x32,0x1F23); write_reg(0x33,0x2425); write_reg(0x34,0x2226); write_reg(0x35,0x2523); write_reg(0x36,0x1C1A); write_reg(0x37,0x131D); write_reg(0x38,0x0B11); write_reg(0x39,0x1210); write_reg(0x3A,0x1315); write_reg(0x3B,0x3619); write_reg(0x3C,0x0D00); write_reg(0x3D,0x000D); write_reg(0x16,0x0007); write_reg(0x02,0x0013); write_reg(0x03,0x0003); write_reg(0x01,0x0127); delayms(1); write_reg(0x08,0x0303); write_reg(0x0A,0x000B); write_reg(0x0B,0x0003); write_reg(0x0C,0x0000); write_reg(0x41,0x0000); write_reg(0x50,0x0000); write_reg(0x60,0x0005); write_reg(0x70,0x000B); write_reg(0x71,0x0000); write_reg(0x78,0x0000); write_reg(0x7A,0x0000); write_reg(0x79,0x0007); write_reg(0x07,0x0051); delayms(1); write_reg(0x07,0x0053); write_reg(0x79,0x0000); reset_viewport(); set_backlight(GDISP_INITIAL_BACKLIGHT); /* Now initialise the GDISP structure */ GDISP.Width = GDISP_SCREEN_WIDTH; GDISP.Height = GDISP_SCREEN_HEIGHT; GDISP.Orientation = GDISP_ROTATE_0; GDISP.Powermode = powerOn; GDISP.Backlight = 100; GDISP.Contrast = 50; #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP GDISP.clipx0 = 0; GDISP.clipy0 = 0; GDISP.clipx1 = GDISP.Width; GDISP.clipy1 = GDISP.Height; #endif return TRUE; }
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { unsigned short DeviceCode; // No private area for this controller g->priv = 0; // Initialise the board interface init_board(g); /* Hardware reset */ setpin_reset(g, TRUE); gfxSleepMilliseconds(1); setpin_reset(g, FALSE); gfxSleepMilliseconds(10); setpin_reset(g, TRUE); gfxSleepMilliseconds(50); acquire_bus(g); setreadmode(g); DeviceCode = read_reg(g, 0x00); setwritemode(g); if( DeviceCode == 0x9320 || DeviceCode == 0x9300 ) { write_reg(g, 0x00, 0x0000); write_reg(g, 0x01, 0x0100); /* Driver Output Contral */ write_reg(g, 0x02, 0x0700); /* LCD Driver Waveform Contral */ write_reg(g, 0x03, 0x1038); /* Set the scan mode */ write_reg(g, 0x04, 0x0000); /* Scalling Contral */ write_reg(g, 0x08, 0x0202); /* Display Contral 2 */ write_reg(g, 0x09, 0x0000); /* Display Contral 3 */ write_reg(g, 0x0a, 0x0000); /* Frame Cycle Contal */ write_reg(g, 0x0c, (1<<0)); /* Extern Display Interface Contral 1 */ write_reg(g, 0x0d, 0x0000); /* Frame Maker Position */ write_reg(g, 0x0f, 0x0000); /* Extern Display Interface Contral 2 */ gfxSleepMilliseconds(50); write_reg(g, 0x07, 0x0101); /* Display Contral */ gfxSleepMilliseconds(50); write_reg(g, 0x10, (1<<12)|(0<<8)|(1<<7)|(1<<6)|(0<<4)); /* Power Control 1 */ write_reg(g, 0x11, 0x0007); /* Power Control 2 */ write_reg(g, 0x12, (1<<8)|(1<<4)|(0<<0)); /* Power Control 3 */ write_reg(g, 0x13, 0x0b00); /* Power Control 4 */ write_reg(g, 0x29, 0x0000); /* Power Control 7 */ write_reg(g, 0x2b, (1<<14)|(1<<4)); write_reg(g, 0x50, 0); /* Set X Start */ write_reg(g, 0x51, 239); /* Set X End */ write_reg(g, 0x52, 0); /* Set Y Start */ write_reg(g, 0x53, 319); /* Set Y End */ gfxSleepMilliseconds(50); write_reg(g, 0x60, 0x2700); /* Driver Output Control */ write_reg(g, 0x61, 0x0001); /* Driver Output Control */ write_reg(g, 0x6a, 0x0000); /* Vertical Srcoll Control */ write_reg(g, 0x80, 0x0000); /* Display Position? Partial Display 1 */ write_reg(g, 0x81, 0x0000); /* RAM Address Start? Partial Display 1 */ write_reg(g, 0x82, 0x0000); /* RAM Address End-Partial Display 1 */ write_reg(g, 0x83, 0x0000); /* Displsy Position? Partial Display 2 */ write_reg(g, 0x84, 0x0000); /* RAM Address Start? Partial Display 2 */ write_reg(g, 0x85, 0x0000); /* RAM Address End? Partial Display 2 */ write_reg(g, 0x90, (0<<7)|(16<<0)); /* Frame Cycle Contral */ write_reg(g, 0x92, 0x0000); /* Panel Interface Contral 2 */ write_reg(g, 0x93, 0x0001); /* Panel Interface Contral 3 */ write_reg(g, 0x95, 0x0110); /* Frame Cycle Contral */ write_reg(g, 0x97, (0<<8)); write_reg(g, 0x98, 0x0000); /* Frame Cycle Contral */ write_reg(g, 0x07, 0x0133); } else if( DeviceCode == 0x9325 || DeviceCode == 0x9328) { write_reg(g, 0x00e7, 0x0010); write_reg(g, 0x0000, 0x0001); /* start internal osc */ write_reg(g, 0x0001, 0x0100); write_reg(g, 0x0002, 0x0700); /* power on sequence */ write_reg(g, 0x0003, (1<<12)|(1<<5)|(1<<4)|(0<<3) ); /* importance */ write_reg(g, 0x0004, 0x0000); write_reg(g, 0x0008, 0x0207); write_reg(g, 0x0009, 0x0000); write_reg(g, 0x000a, 0x0000); /* display setting */ write_reg(g, 0x000c, 0x0001); /* display setting */ write_reg(g, 0x000d, 0x0000); write_reg(g, 0x000f, 0x0000); /* Power On sequence */ write_reg(g, 0x0010, 0x0000); write_reg(g, 0x0011, 0x0007); write_reg(g, 0x0012, 0x0000); write_reg(g, 0x0013, 0x0000); gfxSleepMilliseconds(50); /* delay 50 ms */ write_reg(g, 0x0010, 0x1590); write_reg(g, 0x0011, 0x0227); gfxSleepMilliseconds(50); /* delay 50 ms */ write_reg(g, 0x0012, 0x009c); gfxSleepMilliseconds(50); /* delay 50 ms */ write_reg(g, 0x0013, 0x1900); write_reg(g, 0x0029, 0x0023); write_reg(g, 0x002b, 0x000e); gfxSleepMilliseconds(50); /* delay 50 ms */ write_reg(g, 0x0020, 0x0000); write_reg(g, 0x0021, 0x0000); gfxSleepMilliseconds(50); /* delay 50 ms */ write_reg(g, 0x0030, 0x0007); write_reg(g, 0x0031, 0x0707); write_reg(g, 0x0032, 0x0006); write_reg(g, 0x0035, 0x0704); write_reg(g, 0x0036, 0x1f04); write_reg(g, 0x0037, 0x0004); write_reg(g, 0x0038, 0x0000); write_reg(g, 0x0039, 0x0706); write_reg(g, 0x003c, 0x0701); write_reg(g, 0x003d, 0x000f); gfxSleepMilliseconds(50); /* delay 50 ms */ write_reg(g, 0x0050, 0x0000); write_reg(g, 0x0051, 0x00ef); write_reg(g, 0x0052, 0x0000); write_reg(g, 0x0053, 0x013f); write_reg(g, 0x0060, 0xa700); write_reg(g, 0x0061, 0x0001); write_reg(g, 0x006a, 0x0000); write_reg(g, 0x0080, 0x0000); write_reg(g, 0x0081, 0x0000); write_reg(g, 0x0082, 0x0000); write_reg(g, 0x0083, 0x0000); write_reg(g, 0x0084, 0x0000); write_reg(g, 0x0085, 0x0000); write_reg(g, 0x0090, 0x0010); write_reg(g, 0x0092, 0x0000); write_reg(g, 0x0093, 0x0003); write_reg(g, 0x0095, 0x0110); write_reg(g, 0x0097, 0x0000); write_reg(g, 0x0098, 0x0000); /* display on sequence */ write_reg(g, 0x0007, 0x0133); write_reg(g, 0x0020, 0x0000); write_reg(g, 0x0021, 0x0000); } gfxSleepMilliseconds(100); /* delay 50 ms */ // 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); write_cmd(g, SSD1327_MAST_CODE); //Master code write_data(g, 0x00); write_cmd(g, SSD1327_SET_SLEEP_ON); // set display off write_cmd(g, SSD1327_SET_REMAP); write_data(g, 0x52); write_cmd(g, SSD1327_SET_DISPLAY_START); write_data(g, 0x00); write_cmd(g, SSD1327_SET_DISPLAY_OFFSET); write_data(g, 0x20); write_cmd(g, SSD1327_SET_DISPLAY_MODE_RESET); write_cmd(g, SSD1327_SET_MUX_RATIO); write_data(g, 0x5F); write_cmd(g, SSD1327_SET_FUNCTION_SELECT); write_data(g, 0x01); write_cmd(g, SSD1327_SET_CONTRAST); write_data(g, 0x5F); write_cmd(g, SSD1327_USE_LINEAR_GREY); write_cmd(g, SSD1327_SET_PHASE_LENGTH); write_data(g, 0x31); write_cmd(g, SSD1327_CLOCKDIV_OSCFREQ); write_data(g, 0x41); write_cmd(g, SSD1327_DISPLAY_ENHANCEMENT); write_data(g, 0xB5); write_cmd(g, SSD1327_SET_SECOND_PRECHARGE); write_data(g, 0x04); write_cmd(g, SSD1327_SET_PRECHARGE_VOLTAGE); write_data(g, 0x05); write_cmd(g, SSD1327_SET_VCOMH); write_data(g, 0x07); write_cmd(g, SSD1327_SET_FUNCTION_SELECT_B); write_data(g, 0x02); //i2c restart write_cmd(g, SSD1327_MAST_CODE); //Master code write_data(g, 0x00); write_cmd(g, SSD1327_SET_COLUMN_ADDRESS); //Master code write_data(g, 0x00); //COLUMN START write_data(g, 0x3F); //COLUMN END write_cmd(g, SSD1327_SET_ROW_ADDRESS); //Master code write_data(g, 0x00); //ROW START write_data(g, 0x7F); //ROW END write_cmd(g, SSD1327_MAST_CODE); //Master code write_data(g, 0x40); uint16_t i = 0; for (i = 0; i < 128*128; i++) { write_data(g, 0); } release_bus(g); // 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 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; }