Mercurial > ~darius > hgwebdir.cgi > stm32temp
comparison lcd.c @ 64:ff29436c0224
- Make sure the line is high before pulling low for reset.
- Use delay properly to get the required delays.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Sun, 14 Apr 2013 14:25:51 +0930 |
parents | bb52e6dad784 |
children | 662e7f01c991 |
comparison
equal
deleted
inserted
replaced
63:7e5916574d5e | 64:ff29436c0224 |
---|---|
129 uint16_t id, x, y; | 129 uint16_t id, x, y; |
130 | 130 |
131 /* Initialise LCD panel */ | 131 /* Initialise LCD panel */ |
132 | 132 |
133 /* Pull reset pin low */ | 133 /* Pull reset pin low */ |
134 GPIO_SetBits(GPIOE, GPIO_Pin_1); | |
134 delay(10); | 135 delay(10); |
135 GPIO_ResetBits(GPIOE, GPIO_Pin_1); | 136 GPIO_ResetBits(GPIOE, GPIO_Pin_1); |
136 delay(500); | 137 delay(2000); |
137 GPIO_SetBits(GPIOE, GPIO_Pin_1); | 138 GPIO_SetBits(GPIOE, GPIO_Pin_1); |
138 delay(500); | 139 delay(500); |
139 | 140 |
140 id = lcd_readreg(0x00); | 141 id = lcd_readreg(0x00); |
141 if (id != 0x9325) { | 142 if (id != 0x9325) { |
146 | 147 |
147 lcd_writereg(0x00e3, 0x3008); /* Set internal timing (not documented) */ | 148 lcd_writereg(0x00e3, 0x3008); /* Set internal timing (not documented) */ |
148 lcd_writereg(0x00e7, 0x0012); /* Set internal timing (not documented) */ | 149 lcd_writereg(0x00e7, 0x0012); /* Set internal timing (not documented) */ |
149 lcd_writereg(0x00ef, 0x1231); /* Set internal timing (not documented) */ | 150 lcd_writereg(0x00ef, 0x1231); /* Set internal timing (not documented) */ |
150 lcd_writereg(0x0000, 0x0001); /* Start Oscillation */ | 151 lcd_writereg(0x0000, 0x0001); /* Start Oscillation */ |
151 delay(50); | 152 delay(50000); |
152 lcd_writereg(0x0001, 0x0100); /* set SS (S720 -> S1) */ | 153 lcd_writereg(0x0001, 0x0100); /* set SS (S720 -> S1) */ |
153 lcd_writereg(0x0002, 0x0700); /* set line inversion (B/C + EOR) */ | 154 lcd_writereg(0x0002, 0x0700); /* set line inversion (B/C + EOR) */ |
154 lcd_writereg(0x0004, 0x0000); /* no resizing */ | 155 lcd_writereg(0x0004, 0x0000); /* no resizing */ |
155 lcd_writereg(0x0008, 0x0202); /* set the back porch and front porch (2 lines each) */ | 156 lcd_writereg(0x0008, 0x0202); /* set the back porch and front porch (2 lines each) */ |
156 lcd_writereg(0x0009, 0x0000); /* set non-display area refresh cycle ISC[3:0] */ | 157 lcd_writereg(0x0009, 0x0000); /* set non-display area refresh cycle ISC[3:0] */ |
163 /* Power On sequence */ | 164 /* Power On sequence */ |
164 lcd_writereg(0x0010, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ | 165 lcd_writereg(0x0010, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ |
165 lcd_writereg(0x0011, 0x0007); /* DC1[2:0], DC0[2:0], VC[2:0] */ | 166 lcd_writereg(0x0011, 0x0007); /* DC1[2:0], DC0[2:0], VC[2:0] */ |
166 lcd_writereg(0x0012, 0x0000); /* VREG1OUT voltage */ | 167 lcd_writereg(0x0012, 0x0000); /* VREG1OUT voltage */ |
167 lcd_writereg(0x0013, 0x0000); /* VDV[4:0] for VCOM amplitude */ | 168 lcd_writereg(0x0013, 0x0000); /* VDV[4:0] for VCOM amplitude */ |
168 delay(200); /* Dis-charge capacitor power voltage */ | 169 delay(200000); /* Dis-charge capacitor power voltage */ |
169 lcd_writereg(0x0010, 0x1690); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ | 170 lcd_writereg(0x0010, 0x1690); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ |
170 lcd_writereg(0x0011, 0x0227); /* R11h = 0x0221 at VCI = 3.3V, DC1[2:0], DC0[2:0], VC[2:0] */ | 171 lcd_writereg(0x0011, 0x0227); /* R11h = 0x0221 at VCI = 3.3V, DC1[2:0], DC0[2:0], VC[2:0] */ |
171 delay(50); /* delay 50ms */ | 172 delay(50000); /* delay 50ms */ |
172 lcd_writereg(0x0012, 0x001c); /* External reference voltage= Vci; */ | 173 lcd_writereg(0x0012, 0x001c); /* External reference voltage= Vci; */ |
173 delay(50); /* delay 50ms */ | 174 delay(50000); /* delay 50ms */ |
174 lcd_writereg(0x0013, 0x1800); /* R13 = 1200 when R12 = 009D; VDV[4:0] for VCOM amplitude */ | 175 lcd_writereg(0x0013, 0x1800); /* R13 = 1200 when R12 = 009D; VDV[4:0] for VCOM amplitude */ |
175 lcd_writereg(0x0029, 0x001c); /* R29 = 000C when R12 = 009D; VCM[5:0] for VCOMH */ | 176 lcd_writereg(0x0029, 0x001c); /* R29 = 000C when R12 = 009D; VCM[5:0] for VCOMH */ |
176 lcd_writereg(0x002b, 0x000d); /* Frame Rate = 91Hz */ | 177 lcd_writereg(0x002b, 0x000d); /* Frame Rate = 91Hz */ |
177 delay(50); /* delay 50ms */ | 178 delay(50000); /* delay 50ms */ |
178 | 179 |
179 /* Set GRAM area */ | 180 /* Set GRAM area */ |
180 lcd_writereg(0x0050, 0x0000); /* Horizontal GRAM Start Address */ | 181 lcd_writereg(0x0050, 0x0000); /* Horizontal GRAM Start Address */ |
181 lcd_writereg(0x0051, 0x00ef); /* Horizontal GRAM End Address */ | 182 lcd_writereg(0x0051, 0x00ef); /* Horizontal GRAM End Address */ |
182 lcd_writereg(0x0052, 0x0000); /* Vertical GRAM Start Address */ | 183 lcd_writereg(0x0052, 0x0000); /* Vertical GRAM Start Address */ |