comparison Discovery/Src/display.c @ 878:6b06143cbfea Evo_2_23

brightness settings and proper power down for new screen
author heinrichsweikamp
date Sun, 25 Aug 2024 18:55:43 +0200
parents e373e90a48db
children 8d3f3a635397
comparison
equal deleted inserted replaced
877:a0900e4df15c 878:6b06143cbfea
41 #define OLED_POWER_CONTROL2_1Ch 0x1C // 41 #define OLED_POWER_CONTROL2_1Ch 0x1C //
42 #define OLED_INTERNAL_LOGIC_VOLTAGE 0x22 // VCC*0,65 = 3,3V * 0,55 = 0x00A2 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 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 44 #define OLED_POWER_SET2 0x24 // VREG2OUT = 5,4V, VREG1OUT = 4,2V =0x77
45 #define OLED_DISPLAY_CONDITION_SET_26h 0x26 // 0x00A0 45 #define OLED_DISPLAY_CONDITION_SET_26h 0x26 // 0x00A0
46 #define OLED_STB_BY_OFF 0x1D // 00A0 + 300ms wait 46 #define OLED_STB_BY_OFF_1Dh 0x1D // 00A0 + 300ms wait
47 #define OLED_DDISP_ON 0x14 // 0003 47 #define OLED_DDISP_ON_14h 0x14 // 0003
48 48
49 static void Display_Error_Handler(void); 49 static void Display_Error_Handler(void);
50 static void display_power_on__2_of_2__post_RGB_display0(void); 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); 51 static void display_power_on__2_of_2__post_RGB_display1(void);
52 void display_1_brightness_max(void);
53 void display_1_brightness_high(void);
54 void display_1_brightness_std(void);
55 void display_1_brightness_eco(void);
56 void display_1_brightness_cave(void);
57
52 static uint8_t receive_screen(); 58 static uint8_t receive_screen();
59 uint8_t brightness_screen1;
53 60
54 void display_power_on__1_of_2__pre_RGB(void) 61 void display_power_on__1_of_2__pre_RGB(void)
55 { 62 {
56 uint8_t aTxBuffer[3]; 63 uint8_t aTxBuffer[3];
57 /* reset system */ 64 /* reset system */
155 } 162 }
156 } 163 }
157 } 164 }
158 return outputlength; 165 return outputlength;
159 } 166 }
167
168 void display_power_off(void)
169 {
170 if (hardwareDisplay == 1)
171 {
172 uint8_t aTxBuffer[3];
173
174 aTxBuffer[0] = 0x70;
175 aTxBuffer[1] = OLED_DDISP_ON_14h;
176 send((uint8_t*)aTxBuffer, 2);
177 aTxBuffer[0] = 0x72;
178 aTxBuffer[1] = 0x00;
179 send((uint8_t*)aTxBuffer, 2);
180 HAL_Delay(25);
181 aTxBuffer[0] = 0x70;
182 aTxBuffer[1] = OLED_STB_BY_OFF_1Dh;
183 send((uint8_t*)aTxBuffer, 2);
184 aTxBuffer[0] = 0x72;
185 aTxBuffer[1] = 0xA1;
186 send((uint8_t*)aTxBuffer, 2);
187 HAL_Delay(200);
188 HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_RESET);
189 }
190 else
191 {
192 // display 0
193 }
194 }
195
160 196
161 void display_power_on__2_of_2__post_RGB(void) 197 void display_power_on__2_of_2__post_RGB(void)
162 { 198 {
163 if (hardwareDisplay == 1) 199 if (hardwareDisplay == 1)
164 { 200 {
326 send((uint8_t*)aTxBuffer, 2); 362 send((uint8_t*)aTxBuffer, 2);
327 aTxBuffer[0] = 0x72; 363 aTxBuffer[0] = 0x72;
328 aTxBuffer[1] = 0x08;//8 364 aTxBuffer[1] = 0x08;//8
329 send((uint8_t*)aTxBuffer, 2); 365 send((uint8_t*)aTxBuffer, 2);
330 366
331 //debug read 367 /*//debug read
332 aTxBuffer[0] = 0x70; 368 aTxBuffer[0] = 0x70;
333 aTxBuffer[1] = OLED_SCTE_SET_31h; 369 aTxBuffer[1] = OLED_SCTE_SET_31h;
334 send((uint8_t*)aTxBuffer, 2); 370 send((uint8_t*)aTxBuffer, 2);
335 aTxBuffer[0] = 0x73; // Read internal register 371 aTxBuffer[0] = 0x73; // Read internal register
336 aTxBuffer[1] = 0x00; // Dummy write - reads out 0x08 (The just-set OLED_SCTE_SET value) 372 aTxBuffer[1] = 0x00; // Dummy write - reads out 0x08 (The just-set OLED_SCTE_SET value)
337 send((uint8_t*)aTxBuffer, 2); 373 send((uint8_t*)aTxBuffer, 2);
374 */
338 375
339 aTxBuffer[0] = 0x70; 376 aTxBuffer[0] = 0x70;
340 aTxBuffer[1] = OLED_WCWE_SET_32h; 377 aTxBuffer[1] = OLED_WCWE_SET_32h;
341 send((uint8_t*)aTxBuffer, 2); 378 send((uint8_t*)aTxBuffer, 2);
342 aTxBuffer[0] = 0x72; 379 aTxBuffer[0] = 0x72;
443 send((uint8_t*)aTxBuffer, 2); 480 send((uint8_t*)aTxBuffer, 2);
444 aTxBuffer[0] = 0x72; 481 aTxBuffer[0] = 0x72;
445 aTxBuffer[1] = 0x44;//44 482 aTxBuffer[1] = 0x44;//44
446 send((uint8_t*)aTxBuffer, 2); 483 send((uint8_t*)aTxBuffer, 2);
447 484
448 // GAMMA L=250 485
486 display_1_brightness_std(); // boot brightness
487
488
489 aTxBuffer[0] = 0x70;
490 aTxBuffer[1] = OLED_BOOSTING_FREQ;
491 send((uint8_t*)aTxBuffer, 2);
492 aTxBuffer[0] = 0x72;
493 aTxBuffer[1] = 0x22;
494 send((uint8_t*)aTxBuffer, 2);
495
496 aTxBuffer[0] = 0x70;
497 aTxBuffer[1] = OLED_AMP_SET_18h;
498 send((uint8_t*)aTxBuffer, 2);
499 aTxBuffer[0] = 0x72;
500 aTxBuffer[1] = 0x22;
501 send((uint8_t*)aTxBuffer, 2);
502
503 aTxBuffer[0] = 0x70;
504 aTxBuffer[1] = OLED_GAMMA_AMP_19h;
505 send((uint8_t*)aTxBuffer, 2);
506 aTxBuffer[0] = 0x72;
507 aTxBuffer[1] = 0x02;
508 send((uint8_t*)aTxBuffer, 2);
509
510 aTxBuffer[0] = 0x70;
511 aTxBuffer[1] = OLED_POWER_CONTROL2_1Ah;
512 send((uint8_t*)aTxBuffer, 2);
513 aTxBuffer[0] = 0x72;
514 aTxBuffer[1] = 0x00;
515 send((uint8_t*)aTxBuffer, 2);
516
517 /*
518 aTxBuffer[0] = 0x70;
519 aTxBuffer[1] = OLED_POWER_CONTROL2_1Bh;
520 send((uint8_t*)aTxBuffer, 2);
521 aTxBuffer[0] = 0x72;
522 aTxBuffer[1] = 0x4B;
523 send((uint8_t*)aTxBuffer, 2);
524
525 aTxBuffer[0] = 0x70;
526 aTxBuffer[1] = OLED_POWER_CONTROL2_1Ch;
527 send((uint8_t*)aTxBuffer, 2);
528 aTxBuffer[0] = 0x72;
529 aTxBuffer[1] = 0x05;
530 send((uint8_t*)aTxBuffer, 2);
531 */
532
533 aTxBuffer[0] = 0x70;
534 aTxBuffer[1] = OLED_INTERNAL_LOGIC_VOLTAGE;
535 send((uint8_t*)aTxBuffer, 2);
536 aTxBuffer[0] = 0x72;
537 aTxBuffer[1] = 0xA2;
538 send((uint8_t*)aTxBuffer, 2);
539
540 aTxBuffer[0] = 0x70;
541 aTxBuffer[1] = OLED_POWER_SET;
542 send((uint8_t*)aTxBuffer, 2);
543 aTxBuffer[0] = 0x72;
544 aTxBuffer[1] = 0x00;
545 send((uint8_t*)aTxBuffer, 2);
546
547 aTxBuffer[0] = 0x70;
548 aTxBuffer[1] = OLED_POWER_SET2;
549 send((uint8_t*)aTxBuffer, 2);
550 aTxBuffer[0] = 0x72;
551 aTxBuffer[1] = 0x77;
552 send((uint8_t*)aTxBuffer, 2);
553
554
555 aTxBuffer[0] = 0x70;
556 aTxBuffer[1] = OLED_DISPLAY_CONDITION_SET_26h;
557 send((uint8_t*)aTxBuffer, 2);
558 aTxBuffer[0] = 0x72;
559 aTxBuffer[1] = 0xA0;
560 send((uint8_t*)aTxBuffer, 2);
561
562 aTxBuffer[0] = 0x70;
563 aTxBuffer[1] = OLED_STB_BY_OFF_1Dh;
564 send((uint8_t*)aTxBuffer, 2);
565 aTxBuffer[0] = 0x72;
566 aTxBuffer[1] = 0xA0;
567 send((uint8_t*)aTxBuffer, 2);
568
569 HAL_Delay(250);
570
571 aTxBuffer[0] = 0x70;
572 aTxBuffer[1] = OLED_DDISP_ON_14h;
573 send((uint8_t*)aTxBuffer, 2);
574 aTxBuffer[0] = 0x72;
575 aTxBuffer[1] = 0x03;
576 send((uint8_t*)aTxBuffer, 2);
577 }
578
579 void display_1_brightness_max(void)
580 {
581 uint8_t aTxBuffer[3];
582
583 if (brightness_screen1 == 4)
584 {
585 // do nothing
586 }
587 else
588 {
589 // GAMMA L=250
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] = 0x2A;
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] = 0x27;
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] = 0x27;
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] = 0x1F;
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] = 0x44;
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] = 0x17;
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] = 0x24;
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] = 0x26;
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] = 0x1F;
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] = 0x43;
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] = 0x2A;
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] = 0x25;
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] = 0x24;
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] = 0x1B;
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] = 0x5C;
735 send((uint8_t*)aTxBuffer, 2);
736
737 brightness_screen1=4;
738 }
739 }
740
741 void display_1_brightness_high(void)
742 {
743 uint8_t aTxBuffer[3];
744 if (brightness_screen1 == 3)
745 {
746 // do nothing
747 }
748 else
749 {
750 // GAMMA L=200
449 aTxBuffer[0] = 0x70; 751 aTxBuffer[0] = 0x70;
450 aTxBuffer[1] = 0x40; 752 aTxBuffer[1] = 0x40;
451 send((uint8_t*)aTxBuffer, 2); 753 send((uint8_t*)aTxBuffer, 2);
452 aTxBuffer[0] = 0x72; 754 aTxBuffer[0] = 0x72;
453 aTxBuffer[1] = 0x00; 755 aTxBuffer[1] = 0x00;
591 send((uint8_t*)aTxBuffer, 2); 893 send((uint8_t*)aTxBuffer, 2);
592 aTxBuffer[0] = 0x72; 894 aTxBuffer[0] = 0x72;
593 aTxBuffer[1] = 0x5C; 895 aTxBuffer[1] = 0x5C;
594 send((uint8_t*)aTxBuffer, 2); 896 send((uint8_t*)aTxBuffer, 2);
595 897
596 /* 898 brightness_screen1=3;
899 }
900 }
901
902
903 void display_1_brightness_std(void)
904 {
905 uint8_t aTxBuffer[3];
906
907 if (brightness_screen1 == 2)
908 {
909 // do nothing
910 }
911 else
912 {
597 // GAMMA L=150 913 // GAMMA L=150
598 aTxBuffer[0] = 0x70; 914 aTxBuffer[0] = 0x70;
599 aTxBuffer[1] = 0x40; 915 aTxBuffer[1] = 0x40;
600 send((uint8_t*)aTxBuffer, 2); 916 send((uint8_t*)aTxBuffer, 2);
601 aTxBuffer[0] = 0x72; 917 aTxBuffer[0] = 0x72;
739 aTxBuffer[1] = 0x66; 1055 aTxBuffer[1] = 0x66;
740 send((uint8_t*)aTxBuffer, 2); 1056 send((uint8_t*)aTxBuffer, 2);
741 aTxBuffer[0] = 0x72; 1057 aTxBuffer[0] = 0x72;
742 aTxBuffer[1] = 0x4A; 1058 aTxBuffer[1] = 0x4A;
743 send((uint8_t*)aTxBuffer, 2); 1059 send((uint8_t*)aTxBuffer, 2);
744 */ 1060
745 1061 brightness_screen1=2;
746 aTxBuffer[0] = 0x70; 1062 }
747 aTxBuffer[1] = OLED_BOOSTING_FREQ; 1063 }
1064
1065 void display_1_brightness_eco(void)
1066 {
1067 uint8_t aTxBuffer[3];
1068
1069 if (brightness_screen1 == 1)
1070 {
1071 // do nothing
1072 }
1073 else
1074 {
1075 // GAMMA L=100
1076 aTxBuffer[0] = 0x70;
1077 aTxBuffer[1] = 0x40;
1078 send((uint8_t*)aTxBuffer, 2);
1079 aTxBuffer[0] = 0x72;
1080 aTxBuffer[1] = 0x00;
1081 send((uint8_t*)aTxBuffer, 2);
1082
1083 aTxBuffer[0] = 0x70;
1084 aTxBuffer[1] = 0x41;
1085 send((uint8_t*)aTxBuffer, 2);
1086 aTxBuffer[0] = 0x72;
1087 aTxBuffer[1] = 0x3F;
1088 send((uint8_t*)aTxBuffer, 2);
1089
1090 aTxBuffer[0] = 0x70;
1091 aTxBuffer[1] = 0x42;
1092 send((uint8_t*)aTxBuffer, 2);
1093 aTxBuffer[0] = 0x72;
1094 aTxBuffer[1] = 0x30;
1095 send((uint8_t*)aTxBuffer, 2);
1096
1097 aTxBuffer[0] = 0x70;
1098 aTxBuffer[1] = 0x43;
1099 send((uint8_t*)aTxBuffer, 2);
1100 aTxBuffer[0] = 0x72;
1101 aTxBuffer[1] = 0x2A;
1102 send((uint8_t*)aTxBuffer, 2);
1103
1104 aTxBuffer[0] = 0x70;
1105 aTxBuffer[1] = 0x44;
1106 send((uint8_t*)aTxBuffer, 2);
1107 aTxBuffer[0] = 0x72;
1108 aTxBuffer[1] = 0x2B;
1109 send((uint8_t*)aTxBuffer, 2);
1110
1111 aTxBuffer[0] = 0x70;
1112 aTxBuffer[1] = 0x45;
1113 send((uint8_t*)aTxBuffer, 2);
1114 aTxBuffer[0] = 0x72;
1115 aTxBuffer[1] = 0x24;
1116 send((uint8_t*)aTxBuffer, 2);
1117
1118 aTxBuffer[0] = 0x70;
1119 aTxBuffer[1] = 0x46;
1120 send((uint8_t*)aTxBuffer, 2);
1121 aTxBuffer[0] = 0x72;
1122 aTxBuffer[1] = 0x2F;
1123 send((uint8_t*)aTxBuffer, 2);
1124
1125 aTxBuffer[0] = 0x70;
1126 aTxBuffer[1] = 0x50;
1127 send((uint8_t*)aTxBuffer, 2);
1128 aTxBuffer[0] = 0x72;
1129 aTxBuffer[1] = 0x00;
1130 send((uint8_t*)aTxBuffer, 2);
1131
1132 aTxBuffer[0] = 0x70;
1133 aTxBuffer[1] = 0x51;
1134 send((uint8_t*)aTxBuffer, 2);
1135 aTxBuffer[0] = 0x72;
1136 aTxBuffer[1] = 0x00;
1137 send((uint8_t*)aTxBuffer, 2);
1138
1139 aTxBuffer[0] = 0x70;
1140 aTxBuffer[1] = 0x52;
1141 send((uint8_t*)aTxBuffer, 2);
1142 aTxBuffer[0] = 0x72;
1143 aTxBuffer[1] = 0x00;
1144 send((uint8_t*)aTxBuffer, 2);
1145
1146 aTxBuffer[0] = 0x70;
1147 aTxBuffer[1] = 0x53;
1148 send((uint8_t*)aTxBuffer, 2);
1149 aTxBuffer[0] = 0x72;
1150 aTxBuffer[1] = 0x25;
1151 send((uint8_t*)aTxBuffer, 2);
1152
1153 aTxBuffer[0] = 0x70;
1154 aTxBuffer[1] = 0x54;
1155 send((uint8_t*)aTxBuffer, 2);
1156 aTxBuffer[0] = 0x72;
1157 aTxBuffer[1] = 0x29;
1158 send((uint8_t*)aTxBuffer, 2);
1159
1160 aTxBuffer[0] = 0x70;
1161 aTxBuffer[1] = 0x55;
1162 send((uint8_t*)aTxBuffer, 2);
1163 aTxBuffer[0] = 0x72;
1164 aTxBuffer[1] = 0x24;
1165 send((uint8_t*)aTxBuffer, 2);
1166
1167 aTxBuffer[0] = 0x70;
1168 aTxBuffer[1] = 0x56;
1169 send((uint8_t*)aTxBuffer, 2);
1170 aTxBuffer[0] = 0x72;
1171 aTxBuffer[1] = 0x2E;
1172 send((uint8_t*)aTxBuffer, 2);
1173
1174 aTxBuffer[0] = 0x70;
1175 aTxBuffer[1] = 0x60;
1176 send((uint8_t*)aTxBuffer, 2);
1177 aTxBuffer[0] = 0x72;
1178 aTxBuffer[1] = 0x00;
1179 send((uint8_t*)aTxBuffer, 2);
1180
1181 aTxBuffer[0] = 0x70;
1182 aTxBuffer[1] = 0x61;
1183 send((uint8_t*)aTxBuffer, 2);
1184 aTxBuffer[0] = 0x72;
1185 aTxBuffer[1] = 0x3F;
1186 send((uint8_t*)aTxBuffer, 2);
1187
1188 aTxBuffer[0] = 0x70;
1189 aTxBuffer[1] = 0x62;
1190 send((uint8_t*)aTxBuffer, 2);
1191 aTxBuffer[0] = 0x72;
1192 aTxBuffer[1] = 0x2F;
1193 send((uint8_t*)aTxBuffer, 2);
1194
1195 aTxBuffer[0] = 0x70;
1196 aTxBuffer[1] = 0x63;
1197 send((uint8_t*)aTxBuffer, 2);
1198 aTxBuffer[0] = 0x72;
1199 aTxBuffer[1] = 0x29;
1200 send((uint8_t*)aTxBuffer, 2);
1201
1202 aTxBuffer[0] = 0x70;
1203 aTxBuffer[1] = 0x64;
1204 send((uint8_t*)aTxBuffer, 2);
1205 aTxBuffer[0] = 0x72;
1206 aTxBuffer[1] = 0x29;
1207 send((uint8_t*)aTxBuffer, 2);
1208
1209 aTxBuffer[0] = 0x70;
1210 aTxBuffer[1] = 0x65;
1211 send((uint8_t*)aTxBuffer, 2);
1212 aTxBuffer[0] = 0x72;
1213 aTxBuffer[1] = 0x21;
1214 send((uint8_t*)aTxBuffer, 2);
1215
1216 aTxBuffer[0] = 0x70;
1217 aTxBuffer[1] = 0x66;
1218 send((uint8_t*)aTxBuffer, 2);
1219 aTxBuffer[0] = 0x72;
1220 aTxBuffer[1] = 0x3F;
1221 send((uint8_t*)aTxBuffer, 2);
1222
1223 brightness_screen1=1;
1224 }
1225 }
1226
1227 void display_1_brightness_cave(void)
1228 {
1229 uint8_t aTxBuffer[3];
1230
1231 if (brightness_screen1 == 0)
1232 {
1233 // do nothing
1234 }
1235 else
1236 {
1237 // GAMMA L=50
1238 aTxBuffer[0] = 0x70;
1239 aTxBuffer[1] = 0x40;
1240 send((uint8_t*)aTxBuffer, 2);
1241 aTxBuffer[0] = 0x72;
1242 aTxBuffer[1] = 0x00;
1243 send((uint8_t*)aTxBuffer, 2);
1244
1245 aTxBuffer[0] = 0x70;
1246 aTxBuffer[1] = 0x41;
1247 send((uint8_t*)aTxBuffer, 2);
1248 aTxBuffer[0] = 0x72;
1249 aTxBuffer[1] = 0x3F;
1250 send((uint8_t*)aTxBuffer, 2);
1251
1252 aTxBuffer[0] = 0x70;
1253 aTxBuffer[1] = 0x42;
1254 send((uint8_t*)aTxBuffer, 2);
1255 aTxBuffer[0] = 0x72;
1256 aTxBuffer[1] = 0x3C;
1257 send((uint8_t*)aTxBuffer, 2);
1258
1259 aTxBuffer[0] = 0x70;
1260 aTxBuffer[1] = 0x43;
1261 send((uint8_t*)aTxBuffer, 2);
1262 aTxBuffer[0] = 0x72;
1263 aTxBuffer[1] = 0x2C;
1264 send((uint8_t*)aTxBuffer, 2);
1265
1266 aTxBuffer[0] = 0x70;
1267 aTxBuffer[1] = 0x44;
1268 send((uint8_t*)aTxBuffer, 2);
1269 aTxBuffer[0] = 0x72;
1270 aTxBuffer[1] = 0x2D;
1271 send((uint8_t*)aTxBuffer, 2);
1272
1273 aTxBuffer[0] = 0x70;
1274 aTxBuffer[1] = 0x45;
1275 send((uint8_t*)aTxBuffer, 2);
1276 aTxBuffer[0] = 0x72;
1277 aTxBuffer[1] = 0x27;
1278 send((uint8_t*)aTxBuffer, 2);
1279
1280 aTxBuffer[0] = 0x70;
1281 aTxBuffer[1] = 0x46;
1282 send((uint8_t*)aTxBuffer, 2);
1283 aTxBuffer[0] = 0x72;
1284 aTxBuffer[1] = 0x24;
1285 send((uint8_t*)aTxBuffer, 2);
1286
1287 aTxBuffer[0] = 0x70;
1288 aTxBuffer[1] = 0x50;
1289 send((uint8_t*)aTxBuffer, 2);
1290 aTxBuffer[0] = 0x72;
1291 aTxBuffer[1] = 0x00;
1292 send((uint8_t*)aTxBuffer, 2);
1293
1294 aTxBuffer[0] = 0x70;
1295 aTxBuffer[1] = 0x51;
1296 send((uint8_t*)aTxBuffer, 2);
1297 aTxBuffer[0] = 0x72;
1298 aTxBuffer[1] = 0x00;
1299 send((uint8_t*)aTxBuffer, 2);
1300
1301 aTxBuffer[0] = 0x70;
1302 aTxBuffer[1] = 0x52;
1303 send((uint8_t*)aTxBuffer, 2);
1304 aTxBuffer[0] = 0x72;
1305 aTxBuffer[1] = 0x00;
1306 send((uint8_t*)aTxBuffer, 2);
1307
1308 aTxBuffer[0] = 0x70;
1309 aTxBuffer[1] = 0x53;
748 send((uint8_t*)aTxBuffer, 2); 1310 send((uint8_t*)aTxBuffer, 2);
749 aTxBuffer[0] = 0x72; 1311 aTxBuffer[0] = 0x72;
750 aTxBuffer[1] = 0x22; 1312 aTxBuffer[1] = 0x22;
751 send((uint8_t*)aTxBuffer, 2); 1313 send((uint8_t*)aTxBuffer, 2);
752 1314
753 aTxBuffer[0] = 0x70; 1315 aTxBuffer[0] = 0x70;
754 aTxBuffer[1] = OLED_AMP_SET_18h; 1316 aTxBuffer[1] = 0x54;
755 send((uint8_t*)aTxBuffer, 2); 1317 send((uint8_t*)aTxBuffer, 2);
756 aTxBuffer[0] = 0x72; 1318 aTxBuffer[0] = 0x72;
757 aTxBuffer[1] = 0x22; 1319 aTxBuffer[1] = 0x2A;
758 send((uint8_t*)aTxBuffer, 2); 1320 send((uint8_t*)aTxBuffer, 2);
759 1321
760 aTxBuffer[0] = 0x70; 1322 aTxBuffer[0] = 0x70;
761 aTxBuffer[1] = OLED_GAMMA_AMP_19h; 1323 aTxBuffer[1] = 0x55;
762 send((uint8_t*)aTxBuffer, 2); 1324 send((uint8_t*)aTxBuffer, 2);
763 aTxBuffer[0] = 0x72; 1325 aTxBuffer[0] = 0x72;
764 aTxBuffer[1] = 0x02; 1326 aTxBuffer[1] = 0x27;
765 send((uint8_t*)aTxBuffer, 2); 1327 send((uint8_t*)aTxBuffer, 2);
766 1328
767 aTxBuffer[0] = 0x70; 1329 aTxBuffer[0] = 0x70;
768 aTxBuffer[1] = OLED_POWER_CONTROL2_1Ah; 1330 aTxBuffer[1] = 0x56;
769 send((uint8_t*)aTxBuffer, 2); 1331 send((uint8_t*)aTxBuffer, 2);
770 aTxBuffer[0] = 0x72; 1332 aTxBuffer[0] = 0x72;
771 aTxBuffer[1] = 0x00; 1333 aTxBuffer[1] = 0x23;
772 send((uint8_t*)aTxBuffer, 2); 1334 send((uint8_t*)aTxBuffer, 2);
773 1335
774 /* 1336 aTxBuffer[0] = 0x70;
775 aTxBuffer[0] = 0x70; 1337 aTxBuffer[1] = 0x60;
776 aTxBuffer[1] = OLED_POWER_CONTROL2_1Bh; 1338 send((uint8_t*)aTxBuffer, 2);
777 send((uint8_t*)aTxBuffer, 2); 1339 aTxBuffer[0] = 0x72;
778 aTxBuffer[0] = 0x72; 1340 aTxBuffer[1] = 0x00;
779 aTxBuffer[1] = 0x4B; 1341 send((uint8_t*)aTxBuffer, 2);
780 send((uint8_t*)aTxBuffer, 2); 1342
781 1343 aTxBuffer[0] = 0x70;
782 aTxBuffer[0] = 0x70; 1344 aTxBuffer[1] = 0x61;
783 aTxBuffer[1] = OLED_POWER_CONTROL2_1Ch; 1345 send((uint8_t*)aTxBuffer, 2);
784 send((uint8_t*)aTxBuffer, 2); 1346 aTxBuffer[0] = 0x72;
785 aTxBuffer[0] = 0x72; 1347 aTxBuffer[1] = 0x3F;
786 aTxBuffer[1] = 0x05; 1348 send((uint8_t*)aTxBuffer, 2);
787 send((uint8_t*)aTxBuffer, 2); 1349
788 */ 1350 aTxBuffer[0] = 0x70;
789 1351 aTxBuffer[1] = 0x62;
790 aTxBuffer[0] = 0x70; 1352 send((uint8_t*)aTxBuffer, 2);
791 aTxBuffer[1] = OLED_INTERNAL_LOGIC_VOLTAGE; 1353 aTxBuffer[0] = 0x72;
792 send((uint8_t*)aTxBuffer, 2); 1354 aTxBuffer[1] = 0x3B;
793 aTxBuffer[0] = 0x72; 1355 send((uint8_t*)aTxBuffer, 2);
794 aTxBuffer[1] = 0xA2; 1356
795 send((uint8_t*)aTxBuffer, 2); 1357 aTxBuffer[0] = 0x70;
796 1358 aTxBuffer[1] = 0x63;
797 aTxBuffer[0] = 0x70; 1359 send((uint8_t*)aTxBuffer, 2);
798 aTxBuffer[1] = OLED_POWER_SET; 1360 aTxBuffer[0] = 0x72;
799 send((uint8_t*)aTxBuffer, 2); 1361 aTxBuffer[1] = 0x2C;
800 aTxBuffer[0] = 0x72; 1362 send((uint8_t*)aTxBuffer, 2);
801 aTxBuffer[1] = 0x00; 1363
802 send((uint8_t*)aTxBuffer, 2); 1364 aTxBuffer[0] = 0x70;
803 1365 aTxBuffer[1] = 0x64;
804 aTxBuffer[0] = 0x70; 1366 send((uint8_t*)aTxBuffer, 2);
805 aTxBuffer[1] = OLED_POWER_SET2; 1367 aTxBuffer[0] = 0x72;
806 send((uint8_t*)aTxBuffer, 2); 1368 aTxBuffer[1] = 0x2B;
807 aTxBuffer[0] = 0x72; 1369 send((uint8_t*)aTxBuffer, 2);
808 aTxBuffer[1] = 0x77; 1370
809 send((uint8_t*)aTxBuffer, 2); 1371 aTxBuffer[0] = 0x70;
810 1372 aTxBuffer[1] = 0x65;
811 1373 send((uint8_t*)aTxBuffer, 2);
812 aTxBuffer[0] = 0x70; 1374 aTxBuffer[0] = 0x72;
813 aTxBuffer[1] = OLED_DISPLAY_CONDITION_SET_26h; 1375 aTxBuffer[1] = 0x24;
814 send((uint8_t*)aTxBuffer, 2); 1376 send((uint8_t*)aTxBuffer, 2);
815 aTxBuffer[0] = 0x72; 1377
816 aTxBuffer[1] = 0xA0; 1378 aTxBuffer[0] = 0x70;
817 send((uint8_t*)aTxBuffer, 2); 1379 aTxBuffer[1] = 0x66;
818 1380 send((uint8_t*)aTxBuffer, 2);
819 aTxBuffer[0] = 0x70; 1381 aTxBuffer[0] = 0x72;
820 aTxBuffer[1] = OLED_STB_BY_OFF; 1382 aTxBuffer[1] = 0x31;
821 send((uint8_t*)aTxBuffer, 2); 1383 send((uint8_t*)aTxBuffer, 2);
822 aTxBuffer[0] = 0x72; 1384
823 aTxBuffer[1] = 0xA0; 1385 brightness_screen1=0;
824 send((uint8_t*)aTxBuffer, 2); 1386 }
825
826 HAL_Delay(250);
827
828 aTxBuffer[0] = 0x70;
829 aTxBuffer[1] = OLED_DDISP_ON;
830 send((uint8_t*)aTxBuffer, 2);
831 aTxBuffer[0] = 0x72;
832 aTxBuffer[1] = 0x03;
833 send((uint8_t*)aTxBuffer, 2);
834
835 } 1387 }
836 1388
837 static void Display_Error_Handler(void) 1389 static void Display_Error_Handler(void)
838 { 1390 {
839 //while(1) 1391 //while(1)