Mercurial > public > ostc4
annotate Discovery/Src/display.c @ 871:f7318457df4d default
support for new screen
ToDo: Brightness settings
author | heinrichsweikamp |
---|---|
date | Tue, 13 Aug 2024 13:24:54 +0200 |
parents | 5ca177d2df5d |
children | e373e90a48db |
rev | line source |
---|---|
38 | 1 |
2 #include "stm32f4xx_hal.h" /* for HAL_Delay() */ | |
3 #include "ostc.h" | |
4 #include "display.h" | |
5 | |
871 | 6 #define TFT_ENABLE_EXTENDED_COMMANDS 0xB9 |
7 #define TFT_SET_POWER 0xB1 | |
8 #define TFT_SLEEP_OUT 0x11 | |
9 #define TFT_DISPLAY_INVERSION_OFF 0x20 | |
10 #define TFT_MEMORY_ACCESS_ONTROL 0x36 | |
11 #define TFT_INTERFACE_PIXEL_FORMAT 0x3A | |
12 #define TFT_SET_RGB_INTERFACE_RELATED 0xB3 | |
13 #define TFT_SET_DISPLAY_WAVEFORM 0xB4 | |
14 #define TFT_SET_PANEL 0xCC | |
15 #define TFT_SET_GAMMA_CURVE_RELATED 0xE0 | |
16 #define TFT_DISPLAY_ON 0x29 | |
17 #define TFT_DISPLAY_OFF 0x28 | |
18 #define TFT_SLEEP_IN 0x10 | |
38 | 19 |
871 | 20 #define OLED_SCTE_SET_31h 0x31 // 0x0008 |
21 #define OLED_WCWE_SET_32h 0x32 // 0x0014 | |
22 #define OLED_GATELESS1_30h 0x30 // 0x0002 | |
23 #define OLED_GATELESS2_27h 0x27 // 0x0000 | |
24 #define OLED_OSCILLATOR 0x11 // 0x00A1 | |
25 #define OLED_VBP_SET_12h 0x12 // 0x0008 | |
26 #define OLED_VFP_SET_13h 0x13 // 0x0008 | |
27 #define OLED_DISPLAY_CON_15h 0x15 // 0x0000 | |
28 #define OLED_COLOR_DEPTH_SET_16h 0x16 // 0x0000 | |
29 #define OLED_PENTILE_KEY_EFh 0xEF // 0x00D0 or 0x00E8 | |
30 #define OLED_PENTILE1_A0h 0xA0 // 0x0063 | |
31 #define OLED_PENTILE2_A1h 0xA1 // 0x00C0 | |
32 #define OLED_PENTILE3_A2h 0xA2 // 0x0032 | |
33 #define OLED_PENTILE4_A3h 0xA3 // 0x0002 | |
34 #define OLED_BRIGHTNESS_CTRL_39h 0x39 // 0044h | |
35 // gamma table 0x40 - 0x66 | |
36 #define OLED_BOOSTING_FREQ 0x17 // 0x0022 | |
37 #define OLED_AMP_SET_18h 0x18 // 0x0033 | |
38 #define OLED_GAMMA_AMP_19h 0x19 // 0x0003 | |
39 #define OLED_POWER_CONTROL2_1Ah 0x1A // 0x0001 | |
40 #define OLED_POWER_CONTROL2_1Bh 0x1B // | |
41 #define OLED_POWER_CONTROL2_1Ch 0x1C // | |
42 #define OLED_INTERNAL_LOGIC_VOLTAGE 0x22 // VCC*0,65 = 3,3V * 0,55 = 0x00A2 | |
43 #define OLED_POWER_SET 0x23 // VC1OUT = VCI X 0.98 (default) = 0x00 | |
44 #define OLED_POWER_SET2 0x24 // VREG2OUT = 5,4V, VREG1OUT = 4,2V =0x77 | |
45 #define OLED_DISPLAY_CONDITION_SET_26h 0x26 // 0x00A0 | |
46 #define OLED_STB_BY_OFF 0x1D // 00A0 + 300ms wait | |
47 #define OLED_DDISP_ON 0x14 // 0003 | |
38 | 48 |
49 static void Display_Error_Handler(void); | |
871 | 50 static void display_power_on__2_of_2__post_RGB_display0(void); |
51 static void display_power_on__2_of_2__post_RGB_display1(void); | |
52 static uint8_t receive_screen(); | |
38 | 53 |
54 void display_power_on__1_of_2__pre_RGB(void) | |
55 { | |
871 | 56 uint8_t aTxBuffer[3]; |
57 /* reset system */ | |
38 | 58 HAL_GPIO_WritePin(DISPLAY_CSB_GPIO_PORT,DISPLAY_CSB_PIN,GPIO_PIN_SET); // chip select |
59 | |
60 HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_RESET); | |
61 HAL_Delay(10); | |
62 HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_SET); | |
871 | 63 HAL_Delay(25); |
64 // check for new screen | |
65 hardwareDisplay=0; // default is old screen | |
66 aTxBuffer[0] = 0x71; // Read internal register | |
67 if (receive_screen((uint8_t*)aTxBuffer) == 0x27) // chip Index (=0x27 for new screen) | |
68 { | |
69 hardwareDisplay=1; | |
70 } | |
38 | 71 |
72 /* RGB signals should be now for 2 frames or more (datasheet) */ | |
73 } | |
74 | |
75 | |
300
5ca177d2df5d
cleanup: remove commented/unused code, make static
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
76 static void send(uint8_t *pData, uint16_t inputlength) |
38 | 77 { |
78 HAL_GPIO_WritePin(DISPLAY_CSB_GPIO_PORT,DISPLAY_CSB_PIN,GPIO_PIN_RESET); // chip select | |
79 | |
80 if(HAL_SPI_Transmit(&hspiDisplay,(uint8_t*)pData, inputlength, 10000) != HAL_OK) | |
81 Display_Error_Handler(); | |
82 | |
83 while (HAL_SPI_GetState(&hspiDisplay) != HAL_SPI_STATE_READY) | |
84 { | |
85 } | |
86 HAL_GPIO_WritePin(DISPLAY_CSB_GPIO_PORT,DISPLAY_CSB_PIN,GPIO_PIN_SET); // chip select | |
87 } | |
88 | |
871 | 89 static uint8_t receive_screen(uint8_t *pData) |
90 { | |
91 uint8_t byte; | |
92 HAL_GPIO_WritePin(DISPLAY_CSB_GPIO_PORT,DISPLAY_CSB_PIN,GPIO_PIN_RESET); // chip select | |
93 if(HAL_SPI_Transmit(&hspiDisplay,(uint8_t*)pData, 1, 10000) != HAL_OK) | |
94 Display_Error_Handler(); | |
95 while (HAL_SPI_GetState(&hspiDisplay) != HAL_SPI_STATE_READY) | |
96 { | |
97 } | |
98 if(HAL_SPI_Receive(&hspiDisplay, &byte, 1, 10000) != HAL_OK) | |
99 Display_Error_Handler(); | |
100 while (HAL_SPI_GetState(&hspiDisplay) != HAL_SPI_STATE_READY) | |
101 { | |
102 } | |
103 HAL_GPIO_WritePin(DISPLAY_CSB_GPIO_PORT,DISPLAY_CSB_PIN,GPIO_PIN_SET); // chip select | |
104 return byte; | |
105 } | |
106 | |
38 | 107 |
300
5ca177d2df5d
cleanup: remove commented/unused code, make static
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
108 static uint16_t convert8to9to8(uint8_t *pInput, uint8_t *pOutput,uint16_t inputlength) |
38 | 109 { |
110 uint16_t outputlength; | |
111 uint8_t readbit = 0x80;//0b1000000; | |
112 uint8_t writebit = 0x40;//0b0100000; | |
113 uint16_t i,j,k; | |
114 | |
115 outputlength = ((inputlength+7)/8)*9; | |
116 | |
117 for(i=0;i<outputlength;i++) | |
118 pOutput[i] = 0; | |
119 | |
120 k = 0; | |
121 for(i=0;i<inputlength;i++) | |
122 { | |
123 if(i != 0) | |
124 { | |
125 pOutput[k] |= writebit; // 9. bit | |
126 writebit = writebit >> 1; | |
127 if(writebit == 0) | |
128 { | |
129 writebit = 0x80; | |
130 k++; | |
131 } | |
132 } | |
133 for(j=0;j<8;j++) | |
134 { | |
135 if((pInput[i] & readbit) != 0) | |
136 { | |
137 pOutput[k] |= writebit; | |
138 } | |
139 readbit = readbit >> 1; | |
140 if(readbit == 0) | |
141 readbit = 0x80; | |
142 writebit = writebit >> 1; | |
143 if(writebit == 0) | |
144 { | |
145 writebit = 0x80; | |
146 k++; | |
147 } | |
148 } | |
149 } | |
150 return outputlength; | |
151 } | |
152 | |
153 void display_power_on__2_of_2__post_RGB(void) | |
154 { | |
871 | 155 if (hardwareDisplay == 1) |
156 { | |
157 display_power_on__2_of_2__post_RGB_display1(); | |
158 } | |
159 else | |
160 { | |
161 display_power_on__2_of_2__post_RGB_display0(); | |
162 } | |
163 } | |
164 | |
165 void display_power_on__2_of_2__post_RGB_display0(void) | |
166 { | |
167 | |
38 | 168 uint8_t aTxBuffer[32]; |
169 uint8_t bTxBuffer[36]; | |
170 uint16_t i,length; | |
171 | |
172 for(i=0;i<32;i++) | |
173 aTxBuffer[i] = 0; | |
174 for(i=0;i<36;i++) | |
175 bTxBuffer[i] = 0; | |
176 | |
871 | 177 aTxBuffer[0] = TFT_ENABLE_EXTENDED_COMMANDS; |
38 | 178 aTxBuffer[1] = 0xFF; |
179 aTxBuffer[2] = 0x83; | |
180 aTxBuffer[3] = 0x63; | |
181 length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,4); | |
182 send((uint8_t*)bTxBuffer, length); | |
183 | |
871 | 184 aTxBuffer[0] = TFT_SET_POWER; |
38 | 185 aTxBuffer[1] = 0x81; |
186 aTxBuffer[2] = 0x24; | |
187 aTxBuffer[3] = 0x04; | |
188 aTxBuffer[4] = 0x02; | |
189 aTxBuffer[5] = 0x02; | |
190 aTxBuffer[6] = 0x03; | |
191 aTxBuffer[7] = 0x10; | |
192 aTxBuffer[8] = 0x10; | |
193 aTxBuffer[9] = 0x34; | |
194 aTxBuffer[10] = 0x3C; | |
195 aTxBuffer[11] = 0x3F; | |
196 aTxBuffer[12] = 0x3F; | |
197 length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,13); | |
198 send((uint8_t*)bTxBuffer, length); | |
199 | |
871 | 200 aTxBuffer[0] = TFT_SLEEP_OUT; |
38 | 201 length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,1); |
202 send((uint8_t*)bTxBuffer, length); | |
203 HAL_Delay(5+1); | |
204 | |
871 | 205 aTxBuffer[0] = TFT_DISPLAY_INVERSION_OFF; |
38 | 206 length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,1); |
207 send((uint8_t*)bTxBuffer, length); | |
208 | |
871 | 209 aTxBuffer[0] = TFT_MEMORY_ACCESS_ONTROL; |
38 | 210 aTxBuffer[1] = 0x00; |
211 length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,2); | |
212 send((uint8_t*)bTxBuffer, length); | |
213 | |
871 | 214 aTxBuffer[0] = TFT_INTERFACE_PIXEL_FORMAT; |
38 | 215 aTxBuffer[1] = 0x70; |
216 length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,2); | |
217 send((uint8_t*)bTxBuffer, length); | |
218 HAL_Delay(120+20); | |
219 | |
871 | 220 aTxBuffer[0] = TFT_SET_POWER; |
38 | 221 aTxBuffer[1] = 0x78; |
222 aTxBuffer[2] = 0x24; | |
223 aTxBuffer[3] = 0x04, | |
224 aTxBuffer[4] = 0x02; | |
225 aTxBuffer[5] = 0x02; | |
226 aTxBuffer[6] = 0x03; | |
227 aTxBuffer[7] = 0x10; | |
228 aTxBuffer[8] = 0x10; | |
229 aTxBuffer[9] = 0x34; | |
230 aTxBuffer[10] = 0x3C; | |
231 aTxBuffer[11] = 0x3F; | |
232 aTxBuffer[12] = 0x3F; | |
233 length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,13); | |
234 send((uint8_t*)bTxBuffer, length); | |
235 | |
871 | 236 aTxBuffer[0] = TFT_SET_RGB_INTERFACE_RELATED; |
38 | 237 aTxBuffer[1] = 0x01; |
238 length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,2); | |
239 send((uint8_t*)bTxBuffer, length); | |
240 | |
871 | 241 aTxBuffer[0] = TFT_SET_DISPLAY_WAVEFORM; |
38 | 242 aTxBuffer[1] = 0x00; |
243 aTxBuffer[2] = 0x08; | |
244 aTxBuffer[3] = 0x56; | |
245 aTxBuffer[4] = 0x07; | |
246 aTxBuffer[5] = 0x01; | |
247 aTxBuffer[6] = 0x01; | |
248 aTxBuffer[7] = 0x4D; | |
249 aTxBuffer[8] = 0x01; | |
250 aTxBuffer[9] = 0x42; | |
251 length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,10); | |
252 send((uint8_t*)bTxBuffer, length); | |
253 | |
871 | 254 aTxBuffer[0] = TFT_SET_PANEL; |
38 | 255 aTxBuffer[1] = 0x0B; |
256 length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,2); | |
257 send((uint8_t*)bTxBuffer, length); | |
258 | |
871 | 259 aTxBuffer[0] = TFT_SET_GAMMA_CURVE_RELATED; |
38 | 260 aTxBuffer[1] = 0x01; |
261 aTxBuffer[2] = 0x48; | |
262 aTxBuffer[3] = 0x4D; | |
263 aTxBuffer[4] = 0x4E; | |
264 aTxBuffer[5] = 0x58; | |
265 aTxBuffer[6] = 0xF6; | |
266 aTxBuffer[7] = 0x0B; | |
267 aTxBuffer[8] = 0x4E; | |
268 aTxBuffer[9] = 0x12; | |
269 aTxBuffer[10] = 0xD5; | |
270 aTxBuffer[11] = 0x15; | |
271 aTxBuffer[12] = 0x95; | |
272 aTxBuffer[13] = 0x55; | |
273 aTxBuffer[14] = 0x8E; | |
274 aTxBuffer[15] = 0x11; | |
275 aTxBuffer[16] = 0x01; | |
276 aTxBuffer[17] = 0x48; | |
277 aTxBuffer[18] = 0x4D; | |
278 aTxBuffer[19] = 0x55; | |
279 aTxBuffer[20] = 0x5F; | |
280 aTxBuffer[21] = 0xFD; | |
281 aTxBuffer[22] = 0x0A; | |
282 aTxBuffer[23] = 0x4E; | |
283 aTxBuffer[24] = 0x51; | |
284 aTxBuffer[25] = 0xD3; | |
285 aTxBuffer[26] = 0x17; | |
286 aTxBuffer[27] = 0x95; | |
287 aTxBuffer[28] = 0x96; | |
288 aTxBuffer[29] = 0x4E; | |
289 aTxBuffer[30] = 0x11; | |
290 length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,31); | |
291 send((uint8_t*)bTxBuffer, length); | |
292 HAL_Delay(5+1); | |
293 | |
871 | 294 aTxBuffer[0] = TFT_DISPLAY_ON; |
38 | 295 length = convert8to9to8((uint8_t*)aTxBuffer,(uint8_t*)bTxBuffer,1); |
296 send((uint8_t*)bTxBuffer, length); | |
297 } | |
298 | |
299 | |
871 | 300 void display_power_on__2_of_2__post_RGB_display1(void) |
301 { | |
302 uint8_t aTxBuffer[3]; | |
303 | |
304 aTxBuffer[0] = 0x71; // Read chip Index & revision number | |
305 aTxBuffer[1] = 0x00; // Dummy write - reads out 0x27 | |
306 aTxBuffer[1] = 0x00; // Dummy write - reads out 0x96 | |
307 send((uint8_t*)aTxBuffer, 3); | |
308 | |
309 aTxBuffer[0] = 0x70; | |
310 aTxBuffer[1] = OLED_OSCILLATOR; | |
311 send((uint8_t*)aTxBuffer, 2); | |
312 aTxBuffer[0] = 0x72; | |
313 aTxBuffer[1] = 0xA4; | |
314 send((uint8_t*)aTxBuffer, 2); | |
315 | |
316 aTxBuffer[0] = 0x70; | |
317 aTxBuffer[1] = OLED_SCTE_SET_31h; | |
318 send((uint8_t*)aTxBuffer, 2); | |
319 aTxBuffer[0] = 0x72; | |
320 aTxBuffer[1] = 0x08;//8 | |
321 send((uint8_t*)aTxBuffer, 2); | |
322 | |
323 //debug read | |
324 aTxBuffer[0] = 0x70; | |
325 aTxBuffer[1] = OLED_SCTE_SET_31h; | |
326 send((uint8_t*)aTxBuffer, 2); | |
327 aTxBuffer[0] = 0x73; // Read internal register | |
328 aTxBuffer[1] = 0x00; // Dummy write - reads out 0x08 (The just-set OLED_SCTE_SET value) | |
329 send((uint8_t*)aTxBuffer, 2); | |
330 | |
331 aTxBuffer[0] = 0x70; | |
332 aTxBuffer[1] = OLED_WCWE_SET_32h; | |
333 send((uint8_t*)aTxBuffer, 2); | |
334 aTxBuffer[0] = 0x72; | |
335 aTxBuffer[1] = 0x14;//14 | |
336 send((uint8_t*)aTxBuffer, 2); | |
337 | |
338 aTxBuffer[0] = 0x70; | |
339 aTxBuffer[1] = OLED_GATELESS1_30h; | |
340 send((uint8_t*)aTxBuffer, 2); | |
341 aTxBuffer[0] = 0x72; | |
342 aTxBuffer[1] = 0x02; | |
343 send((uint8_t*)aTxBuffer, 2); | |
344 | |
345 aTxBuffer[0] = 0x70; | |
346 aTxBuffer[1] = OLED_GATELESS2_27h; | |
347 send((uint8_t*)aTxBuffer, 2); | |
348 aTxBuffer[0] = 0x72; | |
349 aTxBuffer[1] = 0x01; | |
350 send((uint8_t*)aTxBuffer, 2); | |
351 | |
352 | |
353 aTxBuffer[0] = 0x70; | |
354 aTxBuffer[1] = OLED_VBP_SET_12h; | |
355 send((uint8_t*)aTxBuffer, 2); | |
356 aTxBuffer[0] = 0x72; | |
357 aTxBuffer[1] = 0x08; | |
358 send((uint8_t*)aTxBuffer, 2); | |
359 | |
360 aTxBuffer[0] = 0x70; | |
361 aTxBuffer[1] = OLED_VFP_SET_13h; | |
362 send((uint8_t*)aTxBuffer, 2); | |
363 aTxBuffer[0] = 0x72; | |
364 aTxBuffer[1] = 0x08; | |
365 send((uint8_t*)aTxBuffer, 2); | |
366 | |
367 aTxBuffer[0] = 0x70; | |
368 aTxBuffer[1] = OLED_DISPLAY_CON_15h; | |
369 send((uint8_t*)aTxBuffer, 2); | |
370 aTxBuffer[0] = 0x72; | |
371 aTxBuffer[1] = 0x01; //SS=0 | |
372 //aTxBuffer[1] = 0x11; //SS=1 | |
373 send((uint8_t*)aTxBuffer, 2); | |
374 | |
375 aTxBuffer[0] = 0x70; | |
376 aTxBuffer[1] = OLED_COLOR_DEPTH_SET_16h; | |
377 send((uint8_t*)aTxBuffer, 2); | |
378 aTxBuffer[0] = 0x72; | |
379 aTxBuffer[1] = 0x00; | |
380 send((uint8_t*)aTxBuffer, 2); | |
381 | |
382 aTxBuffer[0] = 0x70; | |
383 aTxBuffer[1] = OLED_PENTILE_KEY_EFh; // write-only register... | |
384 send((uint8_t*)aTxBuffer, 2); | |
385 aTxBuffer[0] = 0x72; | |
386 aTxBuffer[1] = 0xD0; | |
387 send((uint8_t*)aTxBuffer, 2); | |
388 aTxBuffer[0] = 0x72; | |
389 aTxBuffer[1] = 0xE8; | |
390 send((uint8_t*)aTxBuffer, 2); | |
391 | |
392 aTxBuffer[0] = 0x70; | |
393 aTxBuffer[1] = OLED_PENTILE1_A0h; // write-only register... | |
394 send((uint8_t*)aTxBuffer, 2); | |
395 aTxBuffer[0] = 0x72; | |
396 aTxBuffer[1] = 0x00; | |
397 send((uint8_t*)aTxBuffer, 2); | |
398 aTxBuffer[0] = 0x72; | |
399 aTxBuffer[1] = 0x63; | |
400 send((uint8_t*)aTxBuffer, 2); | |
401 | |
402 aTxBuffer[0] = 0x70; | |
403 aTxBuffer[1] = OLED_PENTILE2_A1h; // write-only register... | |
404 send((uint8_t*)aTxBuffer, 2); | |
405 aTxBuffer[0] = 0x72; | |
406 aTxBuffer[1] = 0x00; | |
407 send((uint8_t*)aTxBuffer, 2); | |
408 aTxBuffer[0] = 0x72; | |
409 aTxBuffer[1] = 0xC0; // SID1&SID0=00 | |
410 // aTxBuffer[1] = 0xC4; // SID1&SID0=01 CC C8 C4 C0 | |
411 send((uint8_t*)aTxBuffer, 2); | |
412 | |
413 aTxBuffer[0] = 0x70; | |
414 aTxBuffer[1] = OLED_PENTILE3_A2h; // write-only register... | |
415 send((uint8_t*)aTxBuffer, 2); | |
416 aTxBuffer[0] = 0x72; | |
417 aTxBuffer[1] = 0x00; | |
418 send((uint8_t*)aTxBuffer, 2); | |
419 aTxBuffer[0] = 0x72; | |
420 aTxBuffer[1] = 0x32; | |
421 send((uint8_t*)aTxBuffer, 2); | |
422 | |
423 aTxBuffer[0] = 0x70; | |
424 aTxBuffer[1] = OLED_PENTILE4_A3h; // write-only register... | |
425 send((uint8_t*)aTxBuffer, 2); | |
426 aTxBuffer[0] = 0x72; | |
427 aTxBuffer[1] = 0x00; | |
428 send((uint8_t*)aTxBuffer, 2); | |
429 aTxBuffer[0] = 0x72; | |
430 aTxBuffer[1] = 0x02; | |
431 send((uint8_t*)aTxBuffer, 2); | |
432 | |
433 aTxBuffer[0] = 0x70; | |
434 aTxBuffer[1] = OLED_BRIGHTNESS_CTRL_39h; | |
435 send((uint8_t*)aTxBuffer, 2); | |
436 aTxBuffer[0] = 0x72; | |
437 aTxBuffer[1] = 0x44;//44 | |
438 send((uint8_t*)aTxBuffer, 2); | |
439 | |
440 // GAMMA L=250 | |
441 aTxBuffer[0] = 0x70; | |
442 aTxBuffer[1] = 0x40; | |
443 send((uint8_t*)aTxBuffer, 2); | |
444 aTxBuffer[0] = 0x72; | |
445 aTxBuffer[1] = 0x00; | |
446 send((uint8_t*)aTxBuffer, 2); | |
447 | |
448 aTxBuffer[0] = 0x70; | |
449 aTxBuffer[1] = 0x41; | |
450 send((uint8_t*)aTxBuffer, 2); | |
451 aTxBuffer[0] = 0x72; | |
452 aTxBuffer[1] = 0x3F; | |
453 send((uint8_t*)aTxBuffer, 2); | |
454 | |
455 aTxBuffer[0] = 0x70; | |
456 aTxBuffer[1] = 0x42; | |
457 send((uint8_t*)aTxBuffer, 2); | |
458 aTxBuffer[0] = 0x72; | |
459 aTxBuffer[1] = 0x2A; | |
460 send((uint8_t*)aTxBuffer, 2); | |
461 | |
462 aTxBuffer[0] = 0x70; | |
463 aTxBuffer[1] = 0x43; | |
464 send((uint8_t*)aTxBuffer, 2); | |
465 aTxBuffer[0] = 0x72; | |
466 aTxBuffer[1] = 0x27; | |
467 send((uint8_t*)aTxBuffer, 2); | |
468 | |
469 aTxBuffer[0] = 0x70; | |
470 aTxBuffer[1] = 0x44; | |
471 send((uint8_t*)aTxBuffer, 2); | |
472 aTxBuffer[0] = 0x72; | |
473 aTxBuffer[1] = 0x27; | |
474 send((uint8_t*)aTxBuffer, 2); | |
475 | |
476 aTxBuffer[0] = 0x70; | |
477 aTxBuffer[1] = 0x45; | |
478 send((uint8_t*)aTxBuffer, 2); | |
479 aTxBuffer[0] = 0x72; | |
480 aTxBuffer[1] = 0x1F; | |
481 send((uint8_t*)aTxBuffer, 2); | |
482 | |
483 aTxBuffer[0] = 0x70; | |
484 aTxBuffer[1] = 0x46; | |
485 send((uint8_t*)aTxBuffer, 2); | |
486 aTxBuffer[0] = 0x72; | |
487 aTxBuffer[1] = 0x44; | |
488 send((uint8_t*)aTxBuffer, 2); | |
489 | |
490 aTxBuffer[0] = 0x70; | |
491 aTxBuffer[1] = 0x50; | |
492 send((uint8_t*)aTxBuffer, 2); | |
493 aTxBuffer[0] = 0x72; | |
494 aTxBuffer[1] = 0x00; | |
495 send((uint8_t*)aTxBuffer, 2); | |
496 | |
497 aTxBuffer[0] = 0x70; | |
498 aTxBuffer[1] = 0x51; | |
499 send((uint8_t*)aTxBuffer, 2); | |
500 aTxBuffer[0] = 0x72; | |
501 aTxBuffer[1] = 0x00; | |
502 send((uint8_t*)aTxBuffer, 2); | |
503 | |
504 aTxBuffer[0] = 0x70; | |
505 aTxBuffer[1] = 0x52; | |
506 send((uint8_t*)aTxBuffer, 2); | |
507 aTxBuffer[0] = 0x72; | |
508 aTxBuffer[1] = 0x17; | |
509 send((uint8_t*)aTxBuffer, 2); | |
510 | |
511 aTxBuffer[0] = 0x70; | |
512 aTxBuffer[1] = 0x53; | |
513 send((uint8_t*)aTxBuffer, 2); | |
514 aTxBuffer[0] = 0x72; | |
515 aTxBuffer[1] = 0x24; | |
516 send((uint8_t*)aTxBuffer, 2); | |
517 | |
518 aTxBuffer[0] = 0x70; | |
519 aTxBuffer[1] = 0x54; | |
520 send((uint8_t*)aTxBuffer, 2); | |
521 aTxBuffer[0] = 0x72; | |
522 aTxBuffer[1] = 0x26; | |
523 send((uint8_t*)aTxBuffer, 2); | |
524 | |
525 aTxBuffer[0] = 0x70; | |
526 aTxBuffer[1] = 0x55; | |
527 send((uint8_t*)aTxBuffer, 2); | |
528 aTxBuffer[0] = 0x72; | |
529 aTxBuffer[1] = 0x1F; | |
530 send((uint8_t*)aTxBuffer, 2); | |
531 | |
532 aTxBuffer[0] = 0x70; | |
533 aTxBuffer[1] = 0x56; | |
534 send((uint8_t*)aTxBuffer, 2); | |
535 aTxBuffer[0] = 0x72; | |
536 aTxBuffer[1] = 0x43; | |
537 send((uint8_t*)aTxBuffer, 2); | |
538 | |
539 aTxBuffer[0] = 0x70; | |
540 aTxBuffer[1] = 0x60; | |
541 send((uint8_t*)aTxBuffer, 2); | |
542 aTxBuffer[0] = 0x72; | |
543 aTxBuffer[1] = 0x00; | |
544 send((uint8_t*)aTxBuffer, 2); | |
545 | |
546 aTxBuffer[0] = 0x70; | |
547 aTxBuffer[1] = 0x61; | |
548 send((uint8_t*)aTxBuffer, 2); | |
549 aTxBuffer[0] = 0x72; | |
550 aTxBuffer[1] = 0x3F; | |
551 send((uint8_t*)aTxBuffer, 2); | |
552 | |
553 aTxBuffer[0] = 0x70; | |
554 aTxBuffer[1] = 0x62; | |
555 send((uint8_t*)aTxBuffer, 2); | |
556 aTxBuffer[0] = 0x72; | |
557 aTxBuffer[1] = 0x2A; | |
558 send((uint8_t*)aTxBuffer, 2); | |
559 | |
560 aTxBuffer[0] = 0x70; | |
561 aTxBuffer[1] = 0x63; | |
562 send((uint8_t*)aTxBuffer, 2); | |
563 aTxBuffer[0] = 0x72; | |
564 aTxBuffer[1] = 0x25; | |
565 send((uint8_t*)aTxBuffer, 2); | |
566 | |
567 aTxBuffer[0] = 0x70; | |
568 aTxBuffer[1] = 0x64; | |
569 send((uint8_t*)aTxBuffer, 2); | |
570 aTxBuffer[0] = 0x72; | |
571 aTxBuffer[1] = 0x24; | |
572 send((uint8_t*)aTxBuffer, 2); | |
573 | |
574 aTxBuffer[0] = 0x70; | |
575 aTxBuffer[1] = 0x65; | |
576 send((uint8_t*)aTxBuffer, 2); | |
577 aTxBuffer[0] = 0x72; | |
578 aTxBuffer[1] = 0x1B; | |
579 send((uint8_t*)aTxBuffer, 2); | |
580 | |
581 aTxBuffer[0] = 0x70; | |
582 aTxBuffer[1] = 0x66; | |
583 send((uint8_t*)aTxBuffer, 2); | |
584 aTxBuffer[0] = 0x72; | |
585 aTxBuffer[1] = 0x5C; | |
586 send((uint8_t*)aTxBuffer, 2); | |
587 | |
588 /* | |
589 // GAMMA L=150 | |
590 aTxBuffer[0] = 0x70; | |
591 aTxBuffer[1] = 0x40; | |
592 send((uint8_t*)aTxBuffer, 2); | |
593 aTxBuffer[0] = 0x72; | |
594 aTxBuffer[1] = 0x00; | |
595 send((uint8_t*)aTxBuffer, 2); | |
596 | |
597 aTxBuffer[0] = 0x70; | |
598 aTxBuffer[1] = 0x41; | |
599 send((uint8_t*)aTxBuffer, 2); | |
600 aTxBuffer[0] = 0x72; | |
601 aTxBuffer[1] = 0x3F; | |
602 send((uint8_t*)aTxBuffer, 2); | |
603 | |
604 aTxBuffer[0] = 0x70; | |
605 aTxBuffer[1] = 0x42; | |
606 send((uint8_t*)aTxBuffer, 2); | |
607 aTxBuffer[0] = 0x72; | |
608 aTxBuffer[1] = 0x2D; | |
609 send((uint8_t*)aTxBuffer, 2); | |
610 | |
611 aTxBuffer[0] = 0x70; | |
612 aTxBuffer[1] = 0x43; | |
613 send((uint8_t*)aTxBuffer, 2); | |
614 aTxBuffer[0] = 0x72; | |
615 aTxBuffer[1] = 0x29; | |
616 send((uint8_t*)aTxBuffer, 2); | |
617 | |
618 aTxBuffer[0] = 0x70; | |
619 aTxBuffer[1] = 0x44; | |
620 send((uint8_t*)aTxBuffer, 2); | |
621 aTxBuffer[0] = 0x72; | |
622 aTxBuffer[1] = 0x28; | |
623 send((uint8_t*)aTxBuffer, 2); | |
624 | |
625 aTxBuffer[0] = 0x70; | |
626 aTxBuffer[1] = 0x45; | |
627 send((uint8_t*)aTxBuffer, 2); | |
628 aTxBuffer[0] = 0x72; | |
629 aTxBuffer[1] = 0x23; | |
630 send((uint8_t*)aTxBuffer, 2); | |
631 | |
632 aTxBuffer[0] = 0x70; | |
633 aTxBuffer[1] = 0x46; | |
634 send((uint8_t*)aTxBuffer, 2); | |
635 aTxBuffer[0] = 0x72; | |
636 aTxBuffer[1] = 0x37; | |
637 send((uint8_t*)aTxBuffer, 2); | |
638 | |
639 aTxBuffer[0] = 0x70; | |
640 aTxBuffer[1] = 0x50; | |
641 send((uint8_t*)aTxBuffer, 2); | |
642 aTxBuffer[0] = 0x72; | |
643 aTxBuffer[1] = 0x00; | |
644 send((uint8_t*)aTxBuffer, 2); | |
645 | |
646 aTxBuffer[0] = 0x70; | |
647 aTxBuffer[1] = 0x51; | |
648 send((uint8_t*)aTxBuffer, 2); | |
649 aTxBuffer[0] = 0x72; | |
650 aTxBuffer[1] = 0x00; | |
651 send((uint8_t*)aTxBuffer, 2); | |
652 | |
653 aTxBuffer[0] = 0x70; | |
654 aTxBuffer[1] = 0x52; | |
655 send((uint8_t*)aTxBuffer, 2); | |
656 aTxBuffer[0] = 0x72; | |
657 aTxBuffer[1] = 0x0B; | |
658 send((uint8_t*)aTxBuffer, 2); | |
659 | |
660 aTxBuffer[0] = 0x70; | |
661 aTxBuffer[1] = 0x53; | |
662 send((uint8_t*)aTxBuffer, 2); | |
663 aTxBuffer[0] = 0x72; | |
664 aTxBuffer[1] = 0x25; | |
665 send((uint8_t*)aTxBuffer, 2); | |
666 | |
667 aTxBuffer[0] = 0x70; | |
668 aTxBuffer[1] = 0x54; | |
669 send((uint8_t*)aTxBuffer, 2); | |
670 aTxBuffer[0] = 0x72; | |
671 aTxBuffer[1] = 0x28; | |
672 send((uint8_t*)aTxBuffer, 2); | |
673 | |
674 aTxBuffer[0] = 0x70; | |
675 aTxBuffer[1] = 0x55; | |
676 send((uint8_t*)aTxBuffer, 2); | |
677 aTxBuffer[0] = 0x72; | |
678 aTxBuffer[1] = 0x22; | |
679 send((uint8_t*)aTxBuffer, 2); | |
680 | |
681 aTxBuffer[0] = 0x70; | |
682 aTxBuffer[1] = 0x56; | |
683 send((uint8_t*)aTxBuffer, 2); | |
684 aTxBuffer[0] = 0x72; | |
685 aTxBuffer[1] = 0x36; | |
686 send((uint8_t*)aTxBuffer, 2); | |
687 | |
688 aTxBuffer[0] = 0x70; | |
689 aTxBuffer[1] = 0x60; | |
690 send((uint8_t*)aTxBuffer, 2); | |
691 aTxBuffer[0] = 0x72; | |
692 aTxBuffer[1] = 0x00; | |
693 send((uint8_t*)aTxBuffer, 2); | |
694 | |
695 aTxBuffer[0] = 0x70; | |
696 aTxBuffer[1] = 0x61; | |
697 send((uint8_t*)aTxBuffer, 2); | |
698 aTxBuffer[0] = 0x72; | |
699 aTxBuffer[1] = 0x3F; | |
700 send((uint8_t*)aTxBuffer, 2); | |
701 | |
702 aTxBuffer[0] = 0x70; | |
703 aTxBuffer[1] = 0x62; | |
704 send((uint8_t*)aTxBuffer, 2); | |
705 aTxBuffer[0] = 0x72; | |
706 aTxBuffer[1] = 0x2B; | |
707 send((uint8_t*)aTxBuffer, 2); | |
708 | |
709 aTxBuffer[0] = 0x70; | |
710 aTxBuffer[1] = 0x63; | |
711 send((uint8_t*)aTxBuffer, 2); | |
712 aTxBuffer[0] = 0x72; | |
713 aTxBuffer[1] = 0x28; | |
714 send((uint8_t*)aTxBuffer, 2); | |
715 | |
716 aTxBuffer[0] = 0x70; | |
717 aTxBuffer[1] = 0x64; | |
718 send((uint8_t*)aTxBuffer, 2); | |
719 aTxBuffer[0] = 0x72; | |
720 aTxBuffer[1] = 0x26; | |
721 send((uint8_t*)aTxBuffer, 2); | |
722 | |
723 aTxBuffer[0] = 0x70; | |
724 aTxBuffer[1] = 0x65; | |
725 send((uint8_t*)aTxBuffer, 2); | |
726 aTxBuffer[0] = 0x72; | |
727 aTxBuffer[1] = 0x1F; | |
728 send((uint8_t*)aTxBuffer, 2); | |
729 | |
730 aTxBuffer[0] = 0x70; | |
731 aTxBuffer[1] = 0x66; | |
732 send((uint8_t*)aTxBuffer, 2); | |
733 aTxBuffer[0] = 0x72; | |
734 aTxBuffer[1] = 0x4A; | |
735 send((uint8_t*)aTxBuffer, 2); | |
736 */ | |
737 | |
738 aTxBuffer[0] = 0x70; | |
739 aTxBuffer[1] = OLED_BOOSTING_FREQ; | |
740 send((uint8_t*)aTxBuffer, 2); | |
741 aTxBuffer[0] = 0x72; | |
742 aTxBuffer[1] = 0x22; | |
743 send((uint8_t*)aTxBuffer, 2); | |
744 | |
745 aTxBuffer[0] = 0x70; | |
746 aTxBuffer[1] = OLED_AMP_SET_18h; | |
747 send((uint8_t*)aTxBuffer, 2); | |
748 aTxBuffer[0] = 0x72; | |
749 aTxBuffer[1] = 0x22; | |
750 send((uint8_t*)aTxBuffer, 2); | |
751 | |
752 aTxBuffer[0] = 0x70; | |
753 aTxBuffer[1] = OLED_GAMMA_AMP_19h; | |
754 send((uint8_t*)aTxBuffer, 2); | |
755 aTxBuffer[0] = 0x72; | |
756 aTxBuffer[1] = 0x02; | |
757 send((uint8_t*)aTxBuffer, 2); | |
758 | |
759 aTxBuffer[0] = 0x70; | |
760 aTxBuffer[1] = OLED_POWER_CONTROL2_1Ah; | |
761 send((uint8_t*)aTxBuffer, 2); | |
762 aTxBuffer[0] = 0x72; | |
763 aTxBuffer[1] = 0x00; | |
764 send((uint8_t*)aTxBuffer, 2); | |
765 | |
766 /* | |
767 aTxBuffer[0] = 0x70; | |
768 aTxBuffer[1] = OLED_POWER_CONTROL2_1Bh; | |
769 send((uint8_t*)aTxBuffer, 2); | |
770 aTxBuffer[0] = 0x72; | |
771 aTxBuffer[1] = 0x4B; | |
772 send((uint8_t*)aTxBuffer, 2); | |
773 | |
774 aTxBuffer[0] = 0x70; | |
775 aTxBuffer[1] = OLED_POWER_CONTROL2_1Ch; | |
776 send((uint8_t*)aTxBuffer, 2); | |
777 aTxBuffer[0] = 0x72; | |
778 aTxBuffer[1] = 0x05; | |
779 send((uint8_t*)aTxBuffer, 2); | |
780 */ | |
781 | |
782 aTxBuffer[0] = 0x70; | |
783 aTxBuffer[1] = OLED_INTERNAL_LOGIC_VOLTAGE; | |
784 send((uint8_t*)aTxBuffer, 2); | |
785 aTxBuffer[0] = 0x72; | |
786 aTxBuffer[1] = 0xA2; | |
787 send((uint8_t*)aTxBuffer, 2); | |
788 | |
789 aTxBuffer[0] = 0x70; | |
790 aTxBuffer[1] = OLED_POWER_SET; | |
791 send((uint8_t*)aTxBuffer, 2); | |
792 aTxBuffer[0] = 0x72; | |
793 aTxBuffer[1] = 0x00; | |
794 send((uint8_t*)aTxBuffer, 2); | |
795 | |
796 aTxBuffer[0] = 0x70; | |
797 aTxBuffer[1] = OLED_POWER_SET2; | |
798 send((uint8_t*)aTxBuffer, 2); | |
799 aTxBuffer[0] = 0x72; | |
800 aTxBuffer[1] = 0x77; | |
801 send((uint8_t*)aTxBuffer, 2); | |
802 | |
803 | |
804 aTxBuffer[0] = 0x70; | |
805 aTxBuffer[1] = OLED_DISPLAY_CONDITION_SET_26h; | |
806 send((uint8_t*)aTxBuffer, 2); | |
807 aTxBuffer[0] = 0x72; | |
808 aTxBuffer[1] = 0xA0; | |
809 send((uint8_t*)aTxBuffer, 2); | |
810 | |
811 aTxBuffer[0] = 0x70; | |
812 aTxBuffer[1] = OLED_STB_BY_OFF; | |
813 send((uint8_t*)aTxBuffer, 2); | |
814 aTxBuffer[0] = 0x72; | |
815 aTxBuffer[1] = 0xA0; | |
816 send((uint8_t*)aTxBuffer, 2); | |
817 | |
818 HAL_Delay(250); | |
819 | |
820 aTxBuffer[0] = 0x70; | |
821 aTxBuffer[1] = OLED_DDISP_ON; | |
822 send((uint8_t*)aTxBuffer, 2); | |
823 aTxBuffer[0] = 0x72; | |
824 aTxBuffer[1] = 0x03; | |
825 send((uint8_t*)aTxBuffer, 2); | |
826 | |
827 } | |
828 | |
38 | 829 static void Display_Error_Handler(void) |
830 { | |
871 | 831 //while(1) |
38 | 832 { |
833 } | |
834 } |