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

📄 high_api.c

📁 VC0558 BackEnd IC Program
💻 C
📖 第 1 页 / 共 5 页
字号:
 	if(!mode)
 	{	
 		if(Size.cx>DeWith && Size.cy>Dehigh)
 		{
  			Size.cx-=DeWith;
  			Size.cy-=Dehigh;
 		}
 		else return 0;
 		if(Size.cx<CapSize.cx||Size.cx<DisSize.cx) return 0xffff;
 		if((x==0xffff)&&(y==0xffff))
  		{
  			V558_IppGetSizerStartp(&StartPoint);
  			StartPoint.x+=(DeWith/2);
  			StartPoint.y+=(Dehigh/2);
  		}
 	}
 	else
 	{
  		Size.cx+=DeWith;
  		Size.cy+=Dehigh;
  		if(Size.cx>g_Preview_Para.Source_W) return 0xffff;
 		if((x==0xffff)&&(y==0xffff))
  		{
  			V558_IppGetSizerStartp(&StartPoint);
  			StartPoint.x-=(DeWith/2);
  			StartPoint.y-=(Dehigh/2);
  		}  		
 	}
 	
	V558_LcdALDisable();
	V558_IppSetZoomDisplay(StartPoint,Size,DisSize.cx);  	
	V558_LcdALEnable();
	
  	ZoomTime=0;
	if(!mode)
	{
		 while(Size.cx>DeWith && Size.cy>Dehigh)
 		{
  			Size.cx-=DeWith;
  			Size.cy-=Dehigh;
 			if(Size.cx<CapSize.cx||Size.cx<DisSize.cx) break;	
 			ZoomTime++;
 		}

	}
	else
	{
		while(1)
		{
  			Size.cx+=DeWith;
  			Size.cy+=Dehigh;
  			if(Size.cx>g_Preview_Para.Source_W) break;
  			ZoomTime++;
		}
	}
  		
	return ZoomTime;
}

/********************************************************************************

 Description:
  	Get the valid zoom steps( USER558_PreviewZoomDisplay() )

 Parameters:
  	mode: 0:zoom in .1:zoom out

Return:
	The total valid zoom steps(please refer the 'step' parameter in USER558_PreviewZoomDisplay() )
UINT16 USER558_PreviewZoomDisplay(UINT8 mode,UINT16 step) )

 Remarks:
  	state: valid

*********************************************************************************/
UINT16  USER558_GetZoomDisplaySteps(UINT8 mode)
{
 	UINT16 DeWith,Dehigh,devisor;
 	UINT16 XRatio, YRatio, ZoomTime;
 	V558_SIZE DisSize;
 	V558_IppGetDispSize(&DisSize);
  	devisor=Find_common_divisor(g_Preview_Para.Source_W,g_Preview_Para.Source_H);

  	XRatio=g_Preview_Para.Source_W/devisor;
  	YRatio=g_Preview_Para.Source_H/devisor;  
  	DeWith=XRatio*ZOOMPIXEL;
  	Dehigh=YRatio*ZOOMPIXEL;
  	if(DeWith==0)  return 0;
  		
  	ZoomTime=0;
	if(mode)
	{

 		while(DisSize.cx>=(DeWith+g_Preview_Para.Display_W) && DisSize.cy>=(Dehigh+g_Preview_Para.Display_H))
 		{
  			DisSize.cx-=DeWith;
  			DisSize.cy-=Dehigh;
  			ZoomTime++;
 		}	
	}
	else
	{ 		
		while(1)
		{
  			DisSize.cx+=DeWith;
  			DisSize.cy+=Dehigh;
  			if(DisSize.cx>g_Preview_Para.Source_W||DisSize.cy>g_Preview_Para.Source_H) break;
  	   		if(DisSize.cx>=0x200||DisSize.cy>=0x200) break;		
  			ZoomTime++;
		}
	}  		
	return ZoomTime;
}
/********************************************************************************

 Description:
  	set jpeg zoom,this function will be called when display a 
  zoom jpeg file.

 Parameters:
  	mode: 0:zoom in .1:zoom out
  	step: zoom step(1 step>=4pixel);
	Lcd_OffsetX: the offsetX in lcd panel
  	Lcd_OffsetY: the offset y in lcd panel
  	Display_W: the width of display window in lcd panel
  	Display_H: the height of display window in lcd panel
  	Zoom_OffsetX: the offset x of jpeg file.(if x=0xffff and y=0xffff than auto find the middle)
  	Zoom_OffsetY: the offset y of jpeg file.
  	return: With current zoom parameter, how many times this function can be called valid
  	(otherwise it will have no effect)

 Note:
  	This function must be used in diplay a jpeg file.
 	step:1-5
 	if the jpeg file 's width or the height is less than the display region in lcd panel,
 the funciton is not effect.

 Remarks:
  	state: valid

*********************************************************************************/
UINT16 USER558_PreviewZoomJpeg(UINT8 mode,UINT16 step,UINT8 *jpegBuf,UINT16 Lcd_OffsetX, UINT16 Lcd_OffsetY, UINT16 Display_W, UINT16 Display_H,UINT16 Zoom_OffsetX, UINT16 Zoom_OffsetY)
{
 	UINT16 DeWith,Dehigh,devisor,SourceW;
 	UINT16 XRatio, YRatio, ZoomTime;
 	V558_SIZE DisSize;
	V558_LAYER_PROPERTY proty;
 	UINT8 Special;

	V558_JPEGBUF decBuf;
	V558_JPEG_INDEX info;
	
	V558_IppGetDispSize(&DisSize);
	
	V558_LcdALEnable();
	Special=V558_LcdGetDispMode();

	decBuf.ActLen = 0x10000;
	decBuf.pData = (UINT8 *)jpegBuf;
	decBuf.Len = 0x8000;

	if(V558_JpegParse(&decBuf, &info) == 0)
	{
		SourceW=info.ImageSize.cx;
  		devisor=Find_common_divisor(info.ImageSize.cx,info.ImageSize.cy);

		XRatio=info.ImageSize.cx/devisor;
  		YRatio=info.ImageSize.cy/devisor;  
  		DeWith=XRatio*4*step;
  		Dehigh=YRatio*4*step;
  		if(DeWith==0)  return 0;
	 	if(mode)
 		{	
 			if(DisSize.cx>=(DeWith+Display_W) && DisSize.cy>=(Dehigh+Display_H))
 			{
  				DisSize.cx-=DeWith;
  				DisSize.cy-=Dehigh;
 			}
 			else return 0;
 		}
 		else
 		{
  			DisSize.cx+=DeWith;
  			DisSize.cy+=Dehigh;
  			if(DisSize.cx>info.ImageSize.cx) return 0;
   			if(DisSize.cy>info.ImageSize.cy) return 0; 
   			if(DisSize.cx>=0x200) return 0;
   			if(DisSize.cy>=0x200) return 0;   		
 		}
		if(Special==0|Special==1)		//90or 270
		{
			proty.Size.cx = DisSize.cx;
			proty.Size.cy = DisSize.cy;
			if(Zoom_OffsetX==0xffff&&Zoom_OffsetY==0xffff)
				{
					proty.DisRect.left =  (DisSize.cx-Display_W)/2;
					proty.DisRect.top =(DisSize.cy-Display_H)/2;
				}
			else
				{
					proty.DisRect.left = Zoom_OffsetX;
					proty.DisRect.top =Zoom_OffsetY;
				}
			proty.DisRect.width = Display_H;
			proty.DisRect.height =Display_W;
			proty.DisPoint.x = Lcd_OffsetX/4;
			proty.DisPoint.y = Lcd_OffsetY;
	
		}
		else		//normal
		{
			proty.Size.cx =DisSize.cx;
			proty.Size.cy = DisSize.cy;
			if(Zoom_OffsetX==0xffff&&Zoom_OffsetY==0xffff)
				{
					proty.DisRect.left =  (DisSize.cx-Display_W)/2;
					proty.DisRect.top =(DisSize.cy-Display_H)/2;
				}
			else
				{
					proty.DisRect.left = Zoom_OffsetX;
					proty.DisRect.top =Zoom_OffsetY;
				}
			proty.DisRect.width = Display_W;
			proty.DisRect.height =Display_H;
			proty.DisPoint.x = Lcd_OffsetX;
			proty.DisPoint.y = Lcd_OffsetY;

		}
		V558_DisplayStill(&decBuf, &info, &proty);
	}
	
	  ZoomTime=0;
	if(mode)
	{

 		while(DisSize.cx>=(DeWith+Display_W) && DisSize.cy>=(Dehigh+Display_H))
 		{
  			DisSize.cx-=DeWith;
  			DisSize.cy-=Dehigh;
  			ZoomTime++;
 		}	
	}
	else
	{ 		
		while(1)
		{
  			DisSize.cx+=DeWith;
  			DisSize.cy+=Dehigh;
  			if(DisSize.cx>info.ImageSize.cx||DisSize.cy>info.ImageSize.cy) break;
  	   		if(DisSize.cx>=0x200||DisSize.cy>=0x200) break;		
  			ZoomTime++;
		}
	}  	
  		
	return ZoomTime;
	g_558_WorkStatus=STATE558_Display;

}

/********************************************************************************

 Description:
  	set 558 Previw Zoom
  	This only effect LCD display, it has no effection with capture. 

 Parameters:
  	mode: 0:zoom in .1:zoom out
  	step: zoom step;

  return: 
  	With current zoom parameter, how many times this function can be called valid
  	(otherwise it will have no effect)
  	if return 0xffff, means zoom failure

 Note:
  	This function must be used in Preview mode, and will NOT effect capture
 	step:1-5

 Remarks:
  	state: valid

*********************************************************************************/
UINT16 USER558_PreviewZoomDisplay(UINT8 mode,UINT16 step)
{
 	UINT16 DeWith,Dehigh,devisor;
 	UINT16 XRatio, YRatio, ZoomTime;
 	V558_SIZE Size,DisSize,CapSize;
 	V558_POINT StartPoint;
 	V558_LAYER_PROPERTY proty;
	//ZoomTime=USER558_GetZoomDisplaySteps(mode);
  	V558_IppGetSizerSize(&Size);
  	V558_IppGetDispSize(&DisSize);
	V558_IppGetCapSize(&CapSize);
	V558_IppGetSizerStartp(&StartPoint);
	
  	devisor=Find_common_divisor(g_Preview_Para.Source_W,g_Preview_Para.Source_H);

  	XRatio=g_Preview_Para.Source_W/devisor;
  	YRatio=g_Preview_Para.Source_H/devisor;  
  	DeWith=XRatio*ZOOMPIXEL*step;
  	Dehigh=YRatio*ZOOMPIXEL*step;
  	if(DeWith==0)  return 0xffff;
  		
 	if(mode)
 	{	
 		if(DisSize.cx>=(DeWith+g_Preview_Para.Display_W) && DisSize.cy>=(Dehigh+g_Preview_Para.Display_H))
 		{
  			DisSize.cx-=DeWith;
  			DisSize.cy-=Dehigh;
 		}
 		else return 0xffff;
 	}
 	else
 	{
  		DisSize.cx+=DeWith;
  		DisSize.cy+=Dehigh;

   		if(DisSize.cx>=Size.cx) return 0xffff;
   		if(DisSize.cy>=Size.cy) return 0xffff; 
   		
   		if(DisSize.cx>=0x200) return 0xffff;
   		if(DisSize.cy>=0x200) return 0xffff;   		
 	}
	proty.Size.cx = DisSize.cx;
	proty.Size.cy = DisSize.cy;
	proty.DisRect.left = (DisSize.cx-g_Preview_Para.Display_W)/2;
	proty.DisRect.top = (DisSize.cy-g_Preview_Para.Display_H)/2;		
	proty.DisRect.width = g_Preview_Para.Display_W;
	proty.DisRect.height =g_Preview_Para.Display_H;
	proty.DisPoint.x = g_Preview_Para.Display_OffsetW;
	proty.DisPoint.y = g_Preview_Para.Display_OffsetH; 	
	V558_LcdDispDisable();
	V558_IppSetZoomDisplay(StartPoint,Size,DisSize.cx);  	
	//V558_IppSetCapture(g_Preview_Para.Capture_W);
	//V558_LcdSetALSize(DisSize);	
	V558_LcdSetALProperty(&proty);
	V558_LcdDispEnable();
	
  	ZoomTime=0;
	if(mode)
	{

 		while(DisSize.cx>=(DeWith+g_Preview_Para.Display_W) && DisSize.cy>=(Dehigh+g_Preview_Para.Display_H))
 		{
  			DisSize.cx-=DeWith;
  			DisSize.cy-=Dehigh;
  			ZoomTime++;
 		}	
	}
	else
	{ 		
		while(1)
		{
  			DisSize.cx+=DeWith;
  			DisSize.cy+=Dehigh;
  			if(DisSize.cx>g_Preview_Para.Source_W||DisSize.cy>g_Preview_Para.Source_H) break;
  	   		if(DisSize.cx>=0x200||DisSize.cy>=0x200) break;		
  			ZoomTime++;
		}
	}  		
	return ZoomTime;
}
/********************************************************************************

 Description:
  	set 558  Zoom

 Parameters:
  	mode: 0:zoom in .1:zoom out
  	step: zoom step;
  	x: offset x in zoom image;if x=0xffff and y=0xffff than auto find the middle
  	y: offset y in zoom image;

  return: 
  	With current zoom parameter, how many times this function can be called valid
  	(otherwise it will have no effect)
  	if return 0xffff, means zoom failure

 Note:
 	step:1-5

 Remarks:
  	state: valid

*********************************************************************************/
UINT16 USER558_Zoom(UINT8 mode,UINT16 step,UINT16 x,UINT16 y)
{
	UINT16 temp1, temp2;
	temp1=USER558_PreviewZoom(mode,step,x,y);
	if(temp1!=0xffff)
		return (temp1+USER558_GetZoomDisplaySteps(mode));
	temp2=USER558_PreviewZoomDisplay(mode,step);
	return temp2;
}
/********************************************************************************

 Description:
  	Get 558 valid Zoom steps

 Parameters:
  	mode: 0:zoom in .1:zoom out
  	step: zoom step;

  return: 
	The total valid zoom steps(please refer the 'step' parameter in USER558_Zoom() )

 Remarks:
  	state: valid

*********************************************************************************/
UINT16 USER558_GetZoomSteps(UINT8 mode)
{
	return USER558_GetPreviewZoomSteps(mode)+USER558_GetZoomDisplaySteps(mode);
}
/********************************************************************************

	Description:
		Set Bypass mode

	Parameters:
		Mode: Set Bypass mode
		PANEL: Set Panel Cs

	Note:
	       This function must be used in 16bit multplex mode
		<TABLE>
		value					meaning
		-----					-------
		0                                       normal mode;
		1                                       start bypass mode.
		</TABLE>
		
		<TABLE>
		value					meaning
		-----					-------
		0                                       Main Panel;
		1                                       Sub Panel.
		</TABLE>

	Remarks:
		state: valid

*********************************************************************************/
void USER558_Set_Bypass(UINT8 Mode,UINT8 PANEL)
{
		#if V558_BUS_TYPE == V558_BUS_SEPERATE
			return;
		#endif
		if(Mode == 1)
		{
			V558_SetReg(V558_REG_BIU_BYPASS_SEL ,0x0); 
			V558_CtrlSetChipClkOn();
			V558_CtrlSetModClkOn(V558_MOD_CLK_LCD);
 			V558_ChangePanelCs(PANEL); 
			V558_CtrlSetChipClkOff();
			V558_CtrlSetWorkMode(V558_MODE_BYPASS);
//			GPIO_WriteIO(0,19);

 		}
		else
		{
//			GPIO_WriteIO(1,19);
		
			V558_CtrlSetWorkMode(V558_MODE_BYPASS);
			V558_Delay(10);			
			V558_CtrlSetWorkMode(V558_MODE_VIEW);
 			V558_CtrlSetChipClkOn();
 			V558_CtrlSetModClkOn(V558_MOD_CLK_LCD);
 			V558_ChangePanelCs(PANEL);
 
 			//V558PanelEnterBypass();			//some panle only
 	
		}

}
/********************************************************************************

	Description:
		Set the value of lcd driver ic register 

	Parameters:
		uVal: the value of the register which will  write to driver ic.
		
	Remarks:
		state: valid

*********************************************************************************/
void USER558_SetVal_By(UINT16 uVal)
{
	 V558_SetVal_By(uVal);
}
/**********************************

⌨️ 快捷键说明

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