📄 t100osd.c
字号:
#include <reg51.h>
#include "common.h"
#include "System.h"
#include "OSDDraw.h"
#include "TwoWire.h"
#include "TW10xReg.h"
#include "T100OSD.h"
#ifdef NEW_OSD
#include "T100A_Font12W16H.c"
#else
#include "T100A_Font12W18H.c"
#endif
#define LOGO_ON
#ifdef LOGO_ON
#define OSDBMP_2BIT_PIXEL 0xf8
#define OSDBMP_4BIT_PIXEL 0xb8
#define OSDBMP_TYPE OSDBMP_2BIT_PIXEL
#define BMP_HPOS (1024-320)/2
#define BMP_VPOS (768-76)/2
//#include "logodata.c"
//#include "logo1025.c"
#include "T100A_Logo.c"
//bit OSD_PowerOnLogo_On = 1;
// define OSD Logo BMP LUT color data
code unsigned char OSDLutLogoData[32]={
0x33,0x03, //Black f=0 , b=0 0x12, 03
0xaa,0x02, //Light Blue f=2 , b=1
0x18,0x01, //Dark Blue f=8 , b=4
0x1f,0x01, //Dark Blue f=8 , b=4
0xff,0x0f, //White f=3
0xf6,0x0f, //Dark Brown f=4 , b=2
0x08,0x08, //Purple f=5
0xa8,0x07, //Light Green f=6 , b=3
0x86,0x0f, //Dark Red f=7
0x54,0x0f, //Dark Red f=7
0x54,0x0f, //Dark Red f=7
0x0f,0x0f,
0xb9,0x00, //purple 6
0x44,0x04,
0x88,0x08, //grey
0xff,0x0f //white
};
#endif //LOGO_ON
void OSDLogo(void)
{
#ifdef LOGO_ON
unsigned int i;
OSDSetRamAddr(FONT_DATA_START_ADDRESS);
I2CWriteByte(TW101,OSD_CFG_INDEX,OSD_LUT_RAM_DATA);
for(i=0;i<32;i++)
I2CWriteByte(TW101,OSD_CFG_DATA,OSDLutLogoData[i]);
OSDCfgWr(BW_W,0x28); //width 40(x8)
OSDCfgWr(BW_H,58); //58 //height 64
OSDCfgWr(BD_ENLARGE,0x00); //
twdWr_Burst_A(OSD_RAM_DL);
//for(i=0;i<80*76;i++){
for(i=0;i<80*58;i++)
twdWr_Burst_D(logodata[i]);
twdWr_Burst_P();
OSDCfgWr(OSD_CTRL,0xf8); //2 bits pixel BitMap
twdDelay(2000);
//OSDDisable();
#endif
}
void OSDInit(void)
{
unsigned int i;
OSDCfgWr(OSD_CTRL,0x18); //disable osd and width*1
/* OSD Position */
#if 0
i=((EepPublic.cOSDVPos&0xe0)>>1)|((EepPublic.cOSDHPos&0xe0)>>5);
OSDCfgWr(CHAR_DLY_0,(uCHAR)i);
i=EepPublic.cOSDHPos<<3;
OSDCfgWr(CHAR_DLY_1,(uCHAR)i);
i=EepPublic.cOSDVPos<<3;
#endif
OSDSetRamAddr(FONT_DATA_START_ADDRESS);
OSDCfgWr(CHAR_FONT_SIZE,FONT_SIZE);
OSDCfgWr(CHAR_RAM_BASE_A,CHAR_MAIN_MENU_START); //To setup character index start address.
//If start address is 0x9c0,
//You have get ((0x9c0 >> 5) & 0x7f) to store it
OSDCfgWr(CHAR_RAM_END_A,CHAR_RAM_END); //This is to set index end address.
OSDCfgWr(CHAR_BS_CTRL,0x40);
OSDCfgWr(CHAR_BS_COLOR,0x00);
OSDCfgWr(CHAR_HEIGHT_CTRL,0x20);
//OSDCfgWr(CHAR_HEIGHT_CTRL,0x40); //For malata only
OSDCfgWr(BLINK_CTRL,0x01);
//OSDCfgWr(ALPHA_BLD_CTRL,0x80); /* Alpha blending is disable */
OSDCfgWr(ALPHA_BLD_CTRL,0x87); //0x86 // Alpha blending is disable; for malata only
OSDLoadColor();
//OSDSetRamAddr(FONT_DATA_START_ADDRESS);
#if 0
// set TW to fast mode
#ifdef TW100K
I2CWriteByte(TW702_WR_ADDR,TW_INTERFACE,0x04);
#else
I2CWriteByte(TW702_WR_ADDR,TW_INTERFACE,0x05);
#endif
#endif
twdWr_Burst_A(OSD_RAM_DL);
//Below is re-writted
for(i=0; i<128*FONT_HEIGHT; i++){
twdWr_Burst_D(font_00[2*i]);
twdWr_Burst_D(font_00[2*i+1]);
}
//0xc00==1024*3;
for(; i<0xc00; i++){
twdWr_Burst_D(0x00);
twdWr_Burst_D(0x00);
}
twdWr_Burst_P();
for(i=0;i<15;i++){
OSDCleanLine(0,i,0,31);
OSDSetLineAttribute(i,0x80);
}
//#endif
}
void OSDShowLine(uCHAR *string,uCHAR x,uCHAR y,uCHAR cColor,uCHAR cLength)
{
if((x < 30) && ( y < 0x13)){
OSDSetRamAddr(MENU_RAM_START_ADDRESS+((int)y << 5)+x);
twdWr_Burst_A(OSD_RAM_DL); // Write OSD index
while((*string) != EOL && (x < cLength)){
twdWr_Burst_D(*string++);
twdWr_Burst_D(cColor );
//twdWr_Burst_D(0xc0);
x++;
}
twdWr_Burst_P();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -