⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 osd_temp.c

📁 一个LCD TV的源程序, 用的是realtek的IC
💻 C
字号:
/*********************************************************************

      COPYRIGHT  (C)  Himax Technologies, Inc.

      File name     : OSD.c

      Description   : Declare OSD Function

      Author        : Taylor

      Create date   : 2004/10/18

      Modifications :
*********************************************************************/

#define _OSD_C

/********************** Include Section *****************************/

#include "osd.h"
#include "osd_font.h"

/********************** Function Implementation *********************/

code unsigned char     // font address
ICONGROUP[TOTAL_ICON][2] = {{0x3C, 0x3D}, {0x3E, 0x3F}, {0x40, 0x41}, {0x42, 0x43}, {0x44, 0x45},
                    {0x46, 0x47}, {0x48, 0x49}, {0x4A, 0x4B}, {0x4E, 0x4F}, {0x4C, 0x4D}
                   };
code unsigned char     // display address
//                     Bri   Cont  HUE   Vol   OSD   Time  Sharp Lan  Source  Exit
ICONPOS[TOTAL_ICON] = {0x42, 0x45, 0x48, 0x4B, 0x4E, 0x51, 0x54, 0x57, 0x5A, 0x5D};
/* ================================================================
    Name    : SetFonts
    Purpose : Set OSD Fonts to HX8824
    Passed  : None
    Notes   : None
   ================================================================ */

void Init_OSD(void)
{
    // Turn OFF OSD
    I2CWriteByte(HX8824_ADDR, HX8824_OSD_CTRL, 0x00);
    // OSD set pallete
    OsdSetPallete();
    // Load OSD Data to HX8824's RAM
    SetFonts();
    // Setup OSD Fonts Size
    I2CWriteByte(HX8824_ADDR, HX8824_OSD_SIZE, (OSD_Y_Ratio << 4) | OSD_X_Ratio) ;
    // Setup OSD Blink Rate
    I2CWriteByte(HX8824_ADDR, HX8824_OSD_BLNKRATE, 0x88);
    I2CWrite2Byte(HX8824_ADDR, HX8824_OSD_Alpha, 0x20, 0x08);
    OsdDrawing();
    // OSD Enable
    //I2CWriteByte(HX8824_ADDR, HX8824_OSD_CTRL, 0x80);
}


/* ================================================================
    Name    : SetFonts
    Purpose : Set OSD Fonts to HX8824
    Passed  : None
    Notes   : None
   ================================================================ */

void SetFonts(void)
{
    // Declare Counter Variable
    Word i;

    // Setup Mono/2-Bits/3-bits/4-Bits Color Font Number
    I2CWrtHead( HX8824_ADDR, HX8824_OSD_COLOR_FONT_NUMBER );   // 0xC9
    for(i = 0; i < 4; i++)
    {
        Write(HX8824_COLOR_COUNT[i]);
    }
    Stop();

    // Point to Font First Address
    I2CWrtHead( HX8824_ADDR, HX8824_FONT_IND_ADR );   // 0xBA
	Write(0x00);
	Write(0x00);

    // Address = 0x00 --> First Data is Empty          addr: 0
    for (i = 0; i < 27; i++)
    {
        Write(FontAsciiSpace[i]);
    }

    // Address = 0x01 --> FontAscii_A_Z                addr: 0x01~0x1A
    for (i = 0; i < 26*27; i++)
    {
        Write(FontAscii_A_Z[i]);
    }

    // Address = 0x1B --> FontAscii_0_9               addr: 0x1B~0x24
    for (i = 0; i < 10*27; i++)
    {
        Write(FontAscii_0_9[i]);
    }

    // Address = 0x25 --> FontIcon                addr: 0x25~0x2A--> border;0x32~0x61 icon
    for (i = 0; i < 65*27; i++)
    {
        Write(FontIcon[i]);
    }

/*
    // Address = 0x01 --> Chinese_0                    addr: 32
    for (i = 0; i < 31*27; i++)
    {
        Write(FontTraditionalChinese_0[i]);
    }

    // Address =0x20 --> Empty                         addr: 33
    for (i = 0; i < 27; i++)
    {
        Write(FontAsciiSpace[i]);
    }

    // Address = 0x21 --> Chinese_1                    addr: 48
    for (i = 0; i < 15*27; i++)
    {
        Write(FontTraditionalChinese_1[i]);
    }

    // Address = 0x3A --> FontTraditionalChinese_2     addr: 64
    for (i = 0; i < 6*27; i++)
    {
        Write(FontTraditionalChinese_2[i]);
    }

    // ============================== //
    // Address =0x40 --> Now is Empty //
    // ============================== //               addr: 65
    for (i = 0; i < 27; i++)
    {
        Write(FontAsciiSpace[i]);
    }
*/
    Stop();

}

/* ================================================================
    Name    : OsdSetStrValueBL
    Purpose : Write OSD One Line String
    Passed  : None
    Notes   : None
   ================================================================ */
/*
void OsdSetStrValueBL(Byte byRow, Byte byCol,
                      Byte bkColor, Byte frColor,
                      Byte length, Byte *ascii)
{
	Byte jj;
    Word kk;

    kk= byRow*40 + byCol;
	I2CWrtHead(HX8824_ADDR, HX8824_DISPLAY_AREA_Y);
	Write((Byte)(kk));
	Write((Byte)(kk>>8));
	Write(bkColor);
    Write(frColor);
	while (length--)
	{
		if (*ascii == '\0')
		{
			Write (0x00);
	  	    for (jj=0 ; jj< length ; jj++)	Write (0x00);
			goto Stop_write;
		}
		else
		{
			Write	(*ascii);
		}
		ascii++;
	}

Stop_write:
	Stop();
}
*/

/* ================================================================
    Name    : SetOsdAlpha
    Purpose : Set OSD Alpha
    Passed  : Foreground --> Set Foreground
              Background --> Set Background
    Notes   : None
   ================================================================ */
/*
void SetOsdAlpha(Byte byIndex,Byte byValue)
{
    // According to byIndex to select background/foreground alpha
    switch(byIndex)
    {
        case Foreground:
            I2CWriteByte(HX8824_ADDR, HX8824_OSD_Alpha_Fore, byValue);
            break;

        case Background:
            I2CWriteByte(HX8824_ADDR, HX8824_OSD_Alpha_Back, byValue);
            break;
    }
}
*/

/* ================================================================
    Name    : OsdSetChanelValue
    Purpose : Write OSD One Line String
    Passed  : None
    Notes   : None
   ================================================================ */
/*
void OsdSetChanelValue(Byte byRow, Byte byCol,
                      Byte bkColor, Byte frColor,
                      Byte byChannel)
{
	Byte jj;
    Word kk;

    Clear_OSD();

    kk= byRow*40 + byCol;
	I2CWrtHead(HX8824_ADDR, HX8824_DISPLAY_AREA_Y);
	Write((Byte)(kk));
	Write((Byte)(kk>>8));
	Write(bkColor);
    Write(frColor);

    // Process κ

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -