📄 t101.lst
字号:
535
536 //****************************************************************
537 #ifdef OSD_EN
538 void OSDShowLine(uCHAR *string,uCHAR x,uCHAR y,uCHAR cColor);
539 void OSDDrawGauge(uCHAR cVal, uCHAR x, uCHAR y, uCHAR cColor);
540 void LoadFont(void);
541 void LoadMenu(void);
542 void ShowOSDData(void);
543 void LoadData(void);
544 void SaveData(void);
545 void InitOSD(void)
546 {
547 1 LoadFont();
548 1 LoadMenu();
549 1 LoadData();
550 1 ShowOSDData();
C51 COMPILER V7.06 T101 01/12/2006 15:42:51 PAGE 10
551 1 OSDDisable();
552 1 }
553 void LoadFont(void)
554 {
555 1 unsigned int i;
556 1 StartCondition();
557 1 Send_Byte(0x50);
558 1 Send_Byte(0xA4);
559 1 for(i=0; i<35*18; i++){
560 2 Send_Byte(font_00[2*i]);
561 2 Send_Byte(font_00[2*i+1]);
562 2 }
563 1 //0xc00==1024*3;
564 1 for(; i<0x360; i++){
565 2 Send_Byte(0x00);
566 2 Send_Byte(0x00);
567 2 }//*/
568 1 StopCondition();
569 1 }
570 void LoadMenu(void)
571 {
572 1 uCHAR i;
573 1 for(i=0;i<4;i++)
574 1 {
575 2 OSDShowLine(iBlankLine,0,i,COL_NORMAL);
576 2 }
577 1 OSDShowLine(iBright_ICON,0,0,COL_NORMAL);
578 1
579 1 OSDShowLine(iColor_ICON,0,1,COL_NORMAL);
580 1
581 1 OSDShowLine(iScreen_ICON,0,2,COL_NORMAL);
582 1
583 1 OSDShowLine(iScreen_ICON,0,3,COL_NORMAL);
584 1
585 1 OSDShowLine(iFULL_ICON,LINE_LENGTH-2,3,COL_NORMAL);
586 1
587 1 OSDShowLine(i4_3_ICON,LINE_LENGTH-3,2,COL_NORMAL);
588 1 OSDDrawGauge(cColor,3,1,COL_GAUGE);
589 1 OSDDrawGauge(cBright,3,0,COL_GAUGE);
590 1 }
591 void ShowOSDData(void)
592 {
593 1 switch(cOSDFunc)
594 1 {
595 2 case 1:
596 2 OSDDrawGauge(cBright,3,0,COL_GAUGE);
597 2 break;
598 2 case 2:
599 2 OSDDrawGauge(cColor,3,1,COL_GAUGE);
600 2 break;
601 2 case 3: break;
602 2 }
603 1 }
604
605 void OSDSetRamAddr(int address)
606 {
607 1 I2CWriteByte(TW100,0xA3,(uCHAR)(address>>8));
608 1 I2CWriteByte(TW100,0xA2,(uCHAR)(address & 0xff));
609 1 }
610 void OSDShowLine(uCHAR *string,uCHAR x,uCHAR y,uCHAR cColor)
611 {
612 1 if((x < 30) && ( y < 0x28))
C51 COMPILER V7.06 T101 01/12/2006 15:42:51 PAGE 11
613 1 {
614 2 OSDSetRamAddr(MENU_START_ADDR+((int)y << 5)+x);
615 2 StartCondition();
616 2 Send_Byte(0x50);
617 2 Send_Byte(0xA4);
618 2 while((*string) != EOL && (x < LINE_LENGTH))
619 2 {
620 3 Send_Byte(*string++);
621 3 Send_Byte(cColor );
622 3 x++;
623 3 }
624 2 StopCondition();
625 2 }
626 1 }
627
628 void OSDDrawGauge(uCHAR cVal, uCHAR x, uCHAR y, uCHAR cColor)
629 {
630 1 uCHAR cTemp1,cTemp2,i=8;
631 1 cTemp1=cVal/2;
632 1 cTemp2=cVal%2;
633 1 OSDSetRamAddr(MENU_START_ADDR+((int)y << 5)+x);
634 1 StartCondition();
635 1 Send_Byte(0x50);
636 1 Send_Byte(0xA4);
637 1 while(i)
638 1 {
639 2 if(cTemp1==0)
640 2 {
641 3 if(i==8)Send_Byte(0x0A+cTemp2);
642 3 else if(i==1)Send_Byte(0x10+cTemp2);
643 3 else Send_Byte(0x0D+cTemp2);
644 3 Send_Byte(cColor);
645 3 i--;
646 3 break;
647 3 }
648 2 else
649 2 {
650 3 if(i==8)Send_Byte(0x0C);
651 3 else if(i==1)Send_Byte(0x12);
652 3 else Send_Byte(0x0F);
653 3 }
654 2 Send_Byte(cColor);
655 2 cTemp1--;
656 2 i--;
657 2 }
658 1 while(i)
659 1 {
660 2 if(i>1)Send_Byte(0x0D);
661 2 else Send_Byte(0x10);
662 2 Send_Byte(cColor);
663 2 i--;
664 2 }
665 1 StopCondition();
666 1 //Num
667 1 cTemp1=cVal/10;
668 1 cTemp2=cVal%10;
669 1 i=cVal/10;
670 1 /* cTemp1=(cVal%100)/10;
671 1 cTemp2=cVal%10;//*/
672 1 OSDSetRamAddr(MENU_START_ADDR+((int)(y) << 5)+(LINE_LENGTH-2));
673 1 StartCondition();
674 1 Send_Byte(0x50);
C51 COMPILER V7.06 T101 01/12/2006 15:42:51 PAGE 12
675 1 Send_Byte(0xA4);
676 1 if(i)Send_Byte(i+0x13);
677 1 else Send_Byte(BLANK);
678 1 Send_Byte(cColor);
679 1 Send_Byte(cTemp2+0x13);
680 1 Send_Byte(cColor);
681 1 StopCondition();
682 1
683 1 }
684 void OSDDisable(void)
685 {
686 1 I2CWriteTbl(OSDDisableTbl);
687 1 }
688 void OSDEnable(void)
689 {
690 1 uCHAR cTemp[8];
691 1 cTemp[0]=TW100;
692 1 cTemp[1]=5;
693 1 cTemp[2]=0xa0;
694 1 cTemp[3]=3;
695 1 cTemp[4]=Y_INC;
696 1 cTemp[5]=0x05;
697 1 cTemp[6]=23+(cOSDFunc-1);
698 1 if((cOSDFunc==3)&&bFULL_43)cTemp[6]+=1;
699 1 cTemp[7]=EOT;
700 1 I2CWriteTbl(cTemp);
701 1 cTemp[5]=0x1E;
702 1 I2CWriteTbl(cTemp);
703 1 I2CWriteTbl(OSDEnableTbl);
704 1 }
705 void OSDCtrl(char cDir)
706 {
707 1 uCHAR cTemp;
708 1 switch(cOSDFunc)
709 1 {
710 2 case 0: OSDDisable();return;
711 2 case 1:
712 2 if((cBright==0x10)&&(cDir==1))return;
713 2 if((cBright==0x00)&&(cDir==-1))return;
714 2 cBright+=cDir;
715 2 if(cBright<16)cTemp=cBright*16;
716 2 else cTemp=0xff;
717 2 I2CWriteByte(TW100,0x69,cTemp);
718 2 break;
719 2 case 2:
720 2 if((cColor==0xfc)&&(cDir==1))return;
721 2 if((cColor==0x00)&&(cDir==-1))return;
722 2 cColor+=cDir*4;
723 2 if(cColor<16)cTemp=cColor*16;
724 2 else cTemp=0xff;
725 2 I2CWriteByte(TW100,0x6c,cTemp);
726 2 break;
727 2 case 3:
728 2 if(Repeat_Times==0)return;
729 2 if(cDir)
730 2 {
731 3 bFULL_43=!bFULL_43;
732 3 SetMode();
733 3 }
734 2 break;
735 2 }
736 1 SaveData();
C51 COMPILER V7.06 T101 01/12/2006 15:42:51 PAGE 13
737 1 ShowOSDData();
738 1 OSDEnable();
739 1 }
740
741
742 void LoadData(void)
743 {
744 1 #ifdef NVRAM
#else
747 1 cBright=BRIGHT;
748 1 cColor=COLOR;
749 1 #endif
750 1 }
751 void SaveData(void)
752 {
753 1 #ifdef NVRAM
#endif
756 1 }
757 #endif
758 bit m_bBKPowerOn =1;
759 bit m_bKyPowerOn =1;
760 bit m_bChipPowerOn =1;
761 void PowerManage(void)
762 {
763 1 if(m_bKyPowerOn) //Power on
764 1 {
765 2 I2CWriteByte(TW100, 0xE0, I2CReadByte(TW100, 0xE0)|0x80);
766 2 //When power on chip, force to reset chip
767 2 m_bChipPowerOn=1;
768 2 Delay_ms(50);
769 2 OpenPanel();
770 2 if(!m_bBKPowerOn)
771 2 BL_EN=0;
772 2 // BKPower();
773 2 }
774 1 else //Forced Power Off
775 1 {
776 2 if(m_bChipPowerOn)
777 2 {
778 3 Delay_ms(50);
779 3 if(m_bBKPowerOn)
780 3 BL_EN=1;
781 3 // BKPower();
782 3 ClosePanel();
783 3 Delay_ms(100);
784 3 I2CWriteByte(TW100, 0xE0, I2CReadByte(TW100, 0xE0)&0x7F);
785 3 m_bChipPowerOn=0;
786 3 }
787 2 }
788 1 }
789
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 2250 ----
CONSTANT SIZE = 2437 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 14 40
IDATA SIZE = ---- ----
C51 COMPILER V7.06 T101 01/12/2006 15:42:51 PAGE 14
BIT SIZE = 8 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -