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

📄 hal_resize.c

📁 一款SmartPhone的驱动代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/************************************************************************
;  	HAL_RESIZE.C
;
;	The routines in this file comprise the function of resize the image form the camera 
;
;	The Function is basic operation of LCDC
;
; 	Copyright (c) 2002 Epson Research and Development, Inc.
;
;  	All Rights Reserved.
;	2002.11.12	D Eric 		Start.					
;														
;************************************************************************/

#include "sysLCDC.h"


/*************************************************************************************
; Function:	Sets active sequence mode
; Input:	Active Sequence Mode
; Output:	None
; Format:	void ActvSequenceModeSet( unsigned char activeSequenceMode )
;*************************************************************************************/
void ActvSequenceModeSet( unsigned char activeSequenceMode )
{
	unsigned short globalResizeCtl = halReadReg16( REG0930_GLOBAL_RESIZE_CTRL);
	globalResizeCtl &= ~0x0003;
	globalResizeCtl |= (unsigned short)activeSequenceMode;
	halWriteReg16( REG0930_GLOBAL_RESIZE_CTRL, globalResizeCtl );
}

/*************************************************************************************
; Function:	retrieves active sequence mode
; Input:	None 
; Output:	Active Sequence Mode
; Format:	unsigned char ActvSequenceModeGet( void )
;*************************************************************************************/
unsigned char ActvSequenceModeGet( void )
{
	unsigned short globalResizeCtl = halReadReg16( REG0930_GLOBAL_RESIZE_CTRL);
	unsigned char activeSequenceMode = (unsigned char)(globalResizeCtl & 0x0003);
	return ( activeSequenceMode );
}


/*************************************************************************************
; Function:	resets software for view resizer
; Input:	None
; Output:	None
; Format:	void ViewSWReset( void )
;*************************************************************************************/
void ViewSWReset( void )
{
	unsigned short captureResizeControl = halReadReg16( REG0940_VIEW_RESIZE_CTRL );
	captureResizeControl |= 0x0080;
	halWriteReg16( REG0940_VIEW_RESIZE_CTRL, captureResizeControl );
}


/*************************************************************************************
; Function :	sets output source select
; Input:	OutSource -- capture or view
; Output:	None
; Format:	void OutSourceSet( ResizeOutSource OutSource )
;*************************************************************************************/
void OutSourceSet( ResizeOutSource OutSource )
{
	unsigned short globalResizeCtl = halReadReg16( REG0930_GLOBAL_RESIZE_CTRL);

	globalResizeCtl &= (~0x0008);
	globalResizeCtl |= (unsigned short)OutSource;
	halWriteReg16( REG0930_GLOBAL_RESIZE_CTRL, globalResizeCtl );
}

/*************************************************************************************
; Function:	retrieves output source select
; Input:	None
; Output:	outSource -- capture or view
; Format:	ResizeOutSource OutSourceGet( void )
;*************************************************************************************/
ResizeOutSource OutSourceGet( void )
{
	unsigned short globalResizeCtl = halReadReg16( REG0930_GLOBAL_RESIZE_CTRL);

	ResizeOutSource OutSource = (ResizeOutSource)(globalResizeCtl & 0x0008);
	return ( OutSource );
}

/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/


/*************************************************************************************
; Function:	sets view resizer enable status
; Input:	enable	TRUE means View Resize logic enabled
;			FALSE means View Resize logic disabled
; Output:	None
; Format:	void ViewEnSet( Boolean enable )
;*************************************************************************************/
void ViewEnSet( BOOL enable )
{
	unsigned short viewResizeCtl = halReadReg16( REG0940_VIEW_RESIZE_CTRL );
	viewResizeCtl &= (~TRUE);
	viewResizeCtl |= (unsigned short)(enable & TRUE);
	halWriteReg16( REG0940_VIEW_RESIZE_CTRL, viewResizeCtl );
}

/*************************************************************************************
; Function:	retrieves view resizer enable status
; Input:	n/a
; Output:	TRUE means View Resize enabled
;		FALSE means View Resize disabled
; Format:	Boolean ViewEnGet( void )
;*************************************************************************************/
BOOL ViewEnGet( void )
{
	unsigned short capResizeCtl = halReadReg16( REG0940_VIEW_RESIZE_CTRL );
	BOOL enable = (BOOL)(capResizeCtl & TRUE);
	return ( enable );
}

/*************************************************************************************
; Function:	sets view resizer start x position
; Input:	View start x position for resizer
; Output:	None
; Format:	void ViewStartXPosSet( unsigned short pos )
;*************************************************************************************/
void ViewStartXPosSet( unsigned short pos )
{
	halWriteReg16( REG0944_VIEW_RESIZE_START_X_POS, pos );
}

/*************************************************************************************
; Function:	retrieves view resizer start X position
; Input:	None
; Output:	View start x position for resizer
; Format:	unsigned short ViewStartXPosGet( void )
;*************************************************************************************/
unsigned short ViewStartXPosGet( void )
{
	unsigned short pos = halReadReg16( REG0944_VIEW_RESIZE_START_X_POS );
	return ( pos );
}

/*************************************************************************************
; Function:	sets view resizer start y position
; Input:	View start y position for resizer
; Output:	None
; Format:	void ViewStartYPosSet( unsigned short pos )
;*************************************************************************************/
void ViewStartYPosSet( unsigned short pos )
{
	halWriteReg16( REG0946_VIEW_RESIZE_START_Y_POS, pos );
}

/*************************************************************************************
; Function:	retrieves view resizer start Y position
; Input:	None
; Output:	View start y position for resizer
; Format:	unsigned short ViewStartYPosGet( void )
;*************************************************************************************/
unsigned short ViewStartYPosGet( void )
{
	unsigned short pos = halReadReg16( REG0946_VIEW_RESIZE_START_Y_POS );
	return ( pos );
}


/*************************************************************************************
; Function:	sets view resizer end x position
; Input:	View end x position for resizer
; Output:	None
; Format:	void ViewEndXPosSet( unsigned short  pos )
;*************************************************************************************/
void ViewEndXPosSet( unsigned short  pos )
{
	halWriteReg16( REG0948_VIEW_RESIZE_END_X_POS, pos );
}

/*************************************************************************************
; Function:	retrieves view resizer end x position
; Input:	None
; Output:	View end x position for resizer
; Format:	unsigned short ViewEndXPosGet( void )
;*************************************************************************************/
unsigned short ViewEndXPosGet( void )
{
	unsigned short pos = halReadReg16( REG0948_VIEW_RESIZE_END_X_POS );
	return ( pos );
}

/*************************************************************************************
; Function:	sets view resizer end y position
; Input:	View end y position for resizer
; Output:	None
; Format:	void ViewEndYPosSet( unsigned short  pos )
;*************************************************************************************/
void ViewEndYPosSet( unsigned short  pos )
{
	halWriteReg16( REG094A_VIEW_RESIZE_END_Y_POS, pos );
}

/*************************************************************************************
; Function:	retrieves view resizer end y position
; Input:	None
; Output:	View end y position for resizer
; Format:	unsigned short ViewEndYPosGet( void )
;*************************************************************************************/
unsigned short ViewEndYPosGet( void )
{
	unsigned short pos = halReadReg16( REG094A_VIEW_RESIZE_END_Y_POS );
	return ( pos );
}

/*************************************************************************************
; Function:	Retrieves Capture Resize Scaling Rate as degree of reduction
; Input:	None
; Output:	View resize scaling rate
; Format:	unsigned char ViewScalingRateGet( void )
;*************************************************************************************/
unsigned char ViewScalingRateGet( void )
{
	unsigned char scalingRate = (unsigned char )halReadReg16( REG094C_VIEW_RESIZE_OP0 );
	scalingRate &= (unsigned char )0x000F;
	return ( scalingRate );
}

/*************************************************************************************
; Function:	sets Capture Resize Scaling Rate as degree of reduction
; Input:	scalingRate		View resize scaling rate
; Output:	None
; Format:	void ViewScalingRateSet( unsigned char  scalingRate )
;*************************************************************************************/
void ViewScalingRateSet( unsigned char  scalingRate )
{
	scalingRate &= (unsigned char )0x000F;
	halWriteReg16( REG094C_VIEW_RESIZE_OP0, (unsigned short)scalingRate );
}

/*************************************************************************************
; Function:	sets view resizer scaling mode
; Input:	scalingMode
; Output:	None
; Format:	void ViewScalingModeSet( ResizeScalingMode scalingMode )
;*************************************************************************************/
void ViewScalingModeSet( ResizeScalingMode scalingMode )
{
	unsigned short viewResizeOperation;

⌨️ 快捷键说明

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