1 | void lcd_init(void)
|
2 | {
|
3 | sbi(DDR(ll_cs_port),ll_cs_pin);
|
4 | ll_cs_high;
|
5 |
|
6 | lcd_spi_init();
|
7 |
|
8 | // DeviceCode = LCD_ReadReg(0x0000); /* Read ID */
|
9 | /* Different driver IC initialization*/
|
10 | // if( DeviceCode == 0x9320 || DeviceCode == 0x9300 )
|
11 | // {
|
12 | lcd_write_reg(0x00,0x0000);
|
13 | lcd_write_reg(0x01,0x0100); /* Driver Output Contral */
|
14 | lcd_write_reg(0x02,0x0700); /* LCD Driver Waveform Contral */
|
15 |
|
16 | #if ( DISP_ORIENTATION == 0 )//0° grad
|
17 | lcd_write_reg(0x0003,(1<<12) ); /* importance */
|
18 | #endif
|
19 | #if ( DISP_ORIENTATION == 1 )//90°
|
20 | lcd_write_reg(0x0003,(1<<12)|(1<<5)|(1<<3) ); /* importance */
|
21 | #endif
|
22 | #if ( DISP_ORIENTATION == 2 )//180°
|
23 | lcd_write_reg(0x0003,(1<<12)|(1<<4)|(1<<5) ); /* importance */
|
24 | #endif
|
25 | #if ( DISP_ORIENTATION == 3 )//270°
|
26 | lcd_write_reg(0x0003,(1<<12)|(1<<4)|(1<<3) ); /* importance */
|
27 | #endif
|
28 | lcd_write_reg(0x04,0x0000); /* Scalling Contral */
|
29 | lcd_write_reg(0x08,0x0202); /* Display Contral 2 */
|
30 | lcd_write_reg(0x09,0x0000); /* Display Contral 3 */
|
31 | lcd_write_reg(0x0a,0x0000); /* Frame Cycle Contal */
|
32 | lcd_write_reg(0x0c,(1<<0)); /* Extern Display Interface Contral 1 */
|
33 | lcd_write_reg(0x0d,0x0000); /* Frame Maker Position */
|
34 | lcd_write_reg(0x0f,0x0000); /* Extern Display Interface Contral 2 */
|
35 | _delay_ms(50);
|
36 | lcd_write_reg(0x07,0x0101); /* Display Contral */
|
37 | _delay_ms(50);
|
38 | lcd_write_reg(0x10,(1<<12)|(0<<8)|(1<<7)|(1<<6)|(0<<4)); /* Power Control 1 */
|
39 | lcd_write_reg(0x11,0x0007); /* Power Control 2 */
|
40 | lcd_write_reg(0x12,(1<<8)|(1<<4)|(0<<0)); /* Power Control 3 */
|
41 | lcd_write_reg(0x13,0x0b00); /* Power Control 4 */
|
42 | lcd_write_reg(0x29,0x0000); /* Power Control 7 */
|
43 | lcd_write_reg(0x2b,(1<<14)|(1<<4));
|
44 |
|
45 | lcd_write_reg(0x50,0); /* Set X Start */
|
46 | lcd_write_reg(0x51,239); /* Set X End */
|
47 | lcd_write_reg(0x52,0); /* Set Y Start */
|
48 | lcd_write_reg(0x53,319); /* Set Y End */
|
49 | _delay_ms(50);
|
50 | lcd_write_reg(0x60,0x2700); /* Driver Output Control */
|
51 | lcd_write_reg(0x61,0x0001); /* Driver Output Control */
|
52 | lcd_write_reg(0x6a,0x0000); /* Vertical Srcoll Control */
|
53 |
|
54 | lcd_write_reg(0x80,0x0000); /* Display Position? Partial Display 1 */
|
55 | lcd_write_reg(0x81,0x0000); /* RAM Address Start? Partial Display 1 */
|
56 | lcd_write_reg(0x82,0x0000); /* RAM Address End-Partial Display 1 */
|
57 | lcd_write_reg(0x83,0x0000); /* Displsy Position? Partial Display 2 */
|
58 | lcd_write_reg(0x84,0x0000); /* RAM Address Start? Partial Display 2 */
|
59 | lcd_write_reg(0x85,0x0000); /* RAM Address End? Partial Display 2 */
|
60 |
|
61 | lcd_write_reg(0x90,(0<<7)|(16<<0)); /* Frame Cycle Contral */
|
62 | lcd_write_reg(0x92,0x0000); /* Panel Interface Contral 2 */
|
63 | lcd_write_reg(0x93,0x0001); /* Panel Interface Contral 3 */
|
64 | lcd_write_reg(0x95,0x0110); /* Frame Cycle Contral */
|
65 | lcd_write_reg(0x97,(0<<8));
|
66 | lcd_write_reg(0x98,0x0000); /* Frame Cycle Contral */
|
67 | lcd_write_reg(0x07,0x0133);
|
68 | // }
|
69 | _delay_ms(100); /* delay 50 ms */
|
70 | }
|