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

📄 osd_deco.c

📁 一个比较好用的TW2835音视频芯片开发板的程序,
💻 C
📖 第 1 页 / 共 2 页
字号:
#include	"hdr.h"
//#include	"osd.h"

//==================================================================================
//						OSD function description
//==================================================================================
void WriteOSDSqrX(U8 _dvc, U8 _hl, U8 _hr, U16 _vt, U16 _vb, U8 _prp, U8 _col)	//... 180(4 pixel/_pos_x) x 240/288 domain
{
	U8 _t1_, _t2_, _t3_;
	
#if	defined(__EN_ISR__)
//	EA = 0;
#endif

	_t1_ = _prp|_col;

	WriteAsicByteOSD(_dvc,0x00,_t1_);					//... 1st pixel
	WriteAsicByteOSD(_dvc,0x01,_t1_);					//... 2nd pixel
	WriteAsicByteOSD(_dvc,0x02,_t1_);					//... 3rd pixel
	WriteAsicByteOSD(_dvc,0x03,_t1_);					//... 4th pixel
	//... acceleration 阑 荤侩且 版快 buffer write 苞沥 积帆啊瓷.
//	WriteAsicByteOSD(_dvc,0x04,0x80);					//... write to buffer

//... start position
	WriteAsicByteOSD(_dvc,0x07,_vt&0xff);
//... end position
	WriteAsicByteOSD(_dvc,0x08,_vb&0xff);

//	WriteAsicByteOSD(_dvc,0x09,0x02|((_vt>>8)<<2)+(_vb>>8));	//... ~ even field
	WriteAsicByteOSD(_dvc,0x09,((_vt>>8)<<2)+(_vb>>8));

	_t2_ = (_hr-_hl)>>4;
	_t3_ = (_hr-_hl)&0x0f;
	
	if (_t2_ != 0) {
			WriteAsicByteOSD(_dvc,0x05,_hl);
			WriteAsicByteOSD(_dvc,0x06,_hl+(_t2_<<4));//79);
		WriteAsicByteOSD(_dvc,0x0a,0xc0);										//... acceleration|x path
		while(ReadAsicOSDMemWr(_dvc)&BIT7){}								//... wait finishing write for even field
	}
	if (_t3_ != 0){
			WriteAsicByteOSD(_dvc,0x05,_hl+(_t2_<<4));//_t1_);
			WriteAsicByteOSD(_dvc,0x06,_hl+((_t2_<<4)+_t3_));//79);
		WriteAsicByteOSD(_dvc,0x0a,0xc0);										//... acceleration|x path
		while(ReadAsicOSDMemWr(_dvc)&BIT7){}								//... wait finishing write for even field
	}
	

#if	defined(__EN_ISR__)
//	EA = 1;
#endif
}
//==================================================================================
//void WriteOSDSqrY(U8 _dvc, U8 _hl, U8 _hr, U16 _vt, U16 _vb, U8 _prp, U8 _col)	//... 90(8 pixel/_pos_x) x 240/288 domain
//{
//	U8 _t1_, _t2_, _t3_;
//	
//#if	defined(__EN_ISR__)
////	EA = 0;
//#endif
//
//	_t1_ = (_prp+(_prp>>4))|((_col<<4)+_col);
//
//	WriteAsicByteOSD(_dvc,0x00,_t1_);					//... 1st pixel
//	WriteAsicByteOSD(_dvc,0x01,_t1_);					//... 2nd pixel
//	WriteAsicByteOSD(_dvc,0x02,_t1_);					//... 3rd pixel
//	WriteAsicByteOSD(_dvc,0x03,_t1_);					//... 4th pixel
//	//... acceleration 阑 荤侩且 版快 buffer write 苞沥 积帆啊瓷.
////	WriteAsicByteOSD(_dvc,0x04,0x80);					//... write to buffer
//
////... start position
//	WriteAsicByteOSD(_dvc,0x07,_vt&0xff);
////... end position
//	WriteAsicByteOSD(_dvc,0x08,_vb&0xff);
//
////	WriteAsicByteOSD(_dvc,0x09,0x02|((_vt>>8)<<2)+(_vb>>8));	//... ~ even field
//	WriteAsicByteOSD(_dvc,0x09,((_vt>>8)<<2)+(_vb>>8));	//... ~ even field
//
//	_t2_ = (_hr-_hl)>>4;
//	_t3_ = (_hr-_hl)&0x0f;
//	
//	if (_t2_ != 0) {
//			WriteAsicByteOSD(_dvc,0x05,_hl);
//			WriteAsicByteOSD(_dvc,0x06,_hl+(_t2_<<4));//79);
//		WriteAsicByteOSD(_dvc,0x0a,0xe0);										//... acceleration|y path
//		while(ReadAsicOSDMemWr(_dvc)&BIT7){}								//... wait finishing write for even field
//	}
//	if (_t3_ != 0){
//			WriteAsicByteOSD(_dvc,0x05,_hl+(_t2_<<4));//_t1_);
//			WriteAsicByteOSD(_dvc,0x06,_hl+((_t2_<<4)+_t3_));//79);
//		WriteAsicByteOSD(_dvc,0x0a,0xe0);										//... acceleration|y path
//		while(ReadAsicOSDMemWr(_dvc)&BIT7){}								//... wait finishing write for even field
//	}
//	
//
//#if	defined(__EN_ISR__)
////	EA = 1;
//#endif
//}
//==================================================================================
void WriteOSDLnVX(U8 _dvc, U8 _pos_x, U16 _pos_y, U8 _typ, U16 _vb, U8 _prp, U8 _col)	//... 180(4 pixel/_pos_x) x 240/288 domain
{
	U8 _ta1_[4];
	
#if	defined(__EN_ISR__)
//	EA = 0;
#endif

	if(_typ == OSD_LN_V_L){
		_ta1_[0] = _prp|_col;
		_ta1_[1] = _prp|_col;
		_ta1_[2] = 0xff;//_prp|_col;
		_ta1_[3] = 0xff;//_prp|_col;
	}
	else if(_typ == OSD_LN_V_R){
		_ta1_[0] = 0xff;//_prp|_col;
		_ta1_[1] = 0xff;//_prp|_col;
		_ta1_[2] = _prp|_col;
		_ta1_[3] = _prp|_col;
	}
	else if(_typ == OSD_LN_V_3D){
		_ta1_[0] = _prp|OSD_COL_25WHT;
		_ta1_[1] = _prp|OSD_COL_25WHT;
		_ta1_[2] = _prp|OSD_COL_BLK;
		_ta1_[3] = _prp|OSD_COL_BLK;
	}
	else if(_typ == OSD_LN_V_BTN){
		_ta1_[0] = _prp|OSD_COL_BLU;				//... main frame color
		_ta1_[1] = _prp|OSD_COL_BLU;
		_ta1_[2] = _prp|OSD_COL_75WHT;
		_ta1_[3] = _prp|OSD_COL_75WHT;
	}
	else if(_typ == OSD_LN_V_DT_BLK_L){
		_ta1_[0] = _prp|_col;
		_ta1_[1] = OSD_MIX|OSD_COL_BLU;			//... main frame color
		_ta1_[2] = OSD_MIX|OSD_COL_BLU;
		_ta1_[3] = OSD_MIX|OSD_COL_BLU;
	}
	else if(_typ == OSD_LN_V_DT_BLK_R){
		_ta1_[0] = OSD_MIX|OSD_COL_BLU;
		_ta1_[1] = OSD_MIX|OSD_COL_BLU;
		_ta1_[2] = OSD_MIX|OSD_COL_BLU;
		_ta1_[3] = _prp|_col;
	}
	else{
		_ta1_[0] = _prp|_col;
		_ta1_[1] = _prp|_col;
		_ta1_[2] = _prp|_col;
		_ta1_[3] = _prp|_col;
	}

	WriteAsicByteOSD(_dvc,0x00,_ta1_[0]);					//... 1st pixel
	WriteAsicByteOSD(_dvc,0x01,_ta1_[1]);					//... 2nd pixel
	WriteAsicByteOSD(_dvc,0x02,_ta1_[2]);					//... 3rd pixel
	WriteAsicByteOSD(_dvc,0x03,_ta1_[3]);					//... 4th pixel
	//... acceleration 阑 荤侩且 版快 buffer write 苞沥 积帆啊瓷.
//	WriteAsicByteOSD(_dvc,0x04,0x80);					//... write to buffer

//... start position
	WriteAsicByteOSD(_dvc,0x05,_pos_x);
	WriteAsicByteOSD(_dvc,0x07,_pos_y&0xff);
//... end position
	WriteAsicByteOSD(_dvc,0x06,_pos_x);
	WriteAsicByteOSD(_dvc,0x08,_vb&0xff);

//	WriteAsicByteOSD(_dvc,0x09,0x02|((_pos_y>>8)<<2)+(_vb>>8));	//... ~ even field
	WriteAsicByteOSD(_dvc,0x09,((_pos_y>>8)<<2)+(_vb>>8));
	WriteAsicByteOSD(_dvc,0x0a,0xc0);										//... acceleration|x path
	while(ReadAsicOSDMemWr(_dvc)&BIT7){}								//... wait finishing write for even field

#if	defined(__EN_ISR__)
//	EA = 1;
#endif
}
//==================================================================================
//void WriteOSDLnVY(U8 _dvc, U8 _pos_x, U16 _pos_y, U8 _typ, U16 _vb, U8 _prp, U8 _col)	//... 90(8 pixel/_pos_x) x 240/288 domain
//{
//	U8 _ta1_[4];
//	
//#if	defined(__EN_ISR__)
////	EA = 0;
//#endif
//
//	if(_typ == OSD_LN_V_GRP){
//		_ta1_[0] = 0xff;
//		_ta1_[1] = (_prp+(_prp>>4))|((OSD_COL_BLK<<4)+OSD_COL_75WHT);
//		_ta1_[2] = (_prp+(_prp>>4))|((OSD_COL_75WHT<<4)+OSD_COL_BLK);
//		_ta1_[3] = 0xff;
//	}
//	else{
//		_ta1_[0] = (_prp+(_prp>>4))|((_col<<4)+_col);
//		_ta1_[1] = (_prp+(_prp>>4))|((_col<<4)+_col);
//		_ta1_[2] = (_prp+(_prp>>4))|((_col<<4)+_col);
//		_ta1_[3] = (_prp+(_prp>>4))|((_col<<4)+_col);
//	}
//
//	WriteAsicByteOSD(_dvc,0x00,_ta1_[0]);					//... 1st pixel
//	WriteAsicByteOSD(_dvc,0x01,_ta1_[1]);					//... 2nd pixel
//	WriteAsicByteOSD(_dvc,0x02,_ta1_[2]);					//... 3rd pixel
//	WriteAsicByteOSD(_dvc,0x03,_ta1_[3]);					//... 4th pixel
//	//... acceleration 阑 荤侩且 版快 buffer write 苞沥 积帆啊瓷.
////	WriteAsicByteOSD(_dvc,0x04,0x80);					//... write to buffer
//
////... start position
//	WriteAsicByteOSD(_dvc,0x05,_pos_x);
//	WriteAsicByteOSD(_dvc,0x07,_pos_y&0xff);
////... end position
//	WriteAsicByteOSD(_dvc,0x06,_pos_x);
//	WriteAsicByteOSD(_dvc,0x08,_vb&0xff);
//
////	WriteAsicByteOSD(_dvc,0x09,0x02|((_pos_y>>8)<<2)+(_vb>>8));	//... ~ even field
//	WriteAsicByteOSD(_dvc,0x09,((_pos_y>>8)<<2)+(_vb>>8));
//	WriteAsicByteOSD(_dvc,0x0a,0xe0);										//... acceleration|y path
//	while(ReadAsicOSDMemWr(_dvc)&BIT7){}								//... wait finishing write for even field
//
//#if	defined(__EN_ISR__)
////	EA = 1;
//#endif
//}
//==================================================================================
//==================================================================================
void	SetOSDGrp(U8 _pth, U8 _pos_x, U8 _pos_y, U8 _lngth, U8 _hght, U8 _prp, U8 code *_str)
{
	U8	_lngth_ = GetCodeLength(_str);
	U8 _hl_, _hr_, _vt_, _vb_;
	U8 _t1_;//, _t2_;

	_hl_ = _pos_x-1;
	_hr_ = _hl_+_lngth+1;

⌨️ 快捷键说明

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