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

📄 hal_resize.c

📁 一款SmartPhone的驱动代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	scalingMode &= 0x0003;
	if ( ViewScalingRateGet() == 2 )
	{
		switch ( scalingMode )
		{
		case 3:
		case 5:
		case 6:
		case 7:
			return;
		}
	}
	viewResizeOperation = halReadReg16( REG094E_VIEW_RESIZE_OP1 );
	viewResizeOperation &= (~0x0003);
	viewResizeOperation |= (unsigned short)scalingMode;
	halWriteReg16( REG094E_VIEW_RESIZE_OP1, viewResizeOperation );
}

/*************************************************************************************
; Function:	retrieves view resizer scaling mode
; Input:	None
; Output:	scalingMode
; Format:	ResizeScalingMode ViewScalingModeGet( void )
;*************************************************************************************/
ResizeScalingMode ViewScalingModeGet( void )
{
	ResizeScalingMode scalingMode = halReadReg16( REG094E_VIEW_RESIZE_OP1 );
	scalingMode &= (ResizeScalingMode)0x0003;
	return ( scalingMode );
}

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


/*************************************************************************************
; Function:	set capture resize enable status
; Input:	enable	TRUE means View Resize enabled
;			FALSE means View Resize disabled
; Output:	None
; Format:	void CapEnSet( Boolean enable )
;*************************************************************************************/
void CapEnSet( BOOL enable )
{
	unsigned short capResizeCtl = halReadReg16( REG0960_CAP_RESIZE_CTRL );
	capResizeCtl &= (~TRUE);
	capResizeCtl |= (unsigned short)enable;
	halWriteReg16( REG0960_CAP_RESIZE_CTRL, capResizeCtl );
}

/*************************************************************************************
; Function:	get capture resize enable status
; Input:	None
; Output:	TRUE means View Resize SW Reset and View Resize enabled
;		FALSE means View Resize disabled
; Format:	Boolean CapEnGet( void )
;*************************************************************************************/
BOOL CapEnGet( void )
{
	unsigned short capResizeCtl = halReadReg16( REG0960_CAP_RESIZE_CTRL );
	BOOL enable = (BOOL)(capResizeCtl & TRUE);
	return ( enable );
}

/*************************************************************************************
; Function:	reset capture resize software 
; Input:	None
; Output:	None
; Format:	void CapSWReset( void )
;*************************************************************************************/
void CapSWReset( void )
{
	unsigned short capResizeCtl = halReadReg16( REG0960_CAP_RESIZE_CTRL );
	capResizeCtl |= 0x0080;
	halWriteReg16( REG0960_CAP_RESIZE_CTRL, capResizeCtl );
}

/*************************************************************************************
; Function:	set capture resizer start x position
; Input:	X start position of capture resizer
; Output:	None
; Format:	void CapStartXPosSet( unsigned short pos )
;*************************************************************************************/
void CapStartXPosSet( unsigned short pos )
{
	halWriteReg16( REG0964_CAP_RESIZE_START_X_POS, pos );
}

/*************************************************************************************
; Function:	get capture resizer start x position
; Input:	None
; Output:	X start position of capture resizer
; Format:	unsigned short CapStartXPosGet( void )
;*************************************************************************************/
unsigned short CapStartXPosGet( void )
{
	unsigned short pos = halReadReg16( REG0964_CAP_RESIZE_START_X_POS );
	return ( pos );
}

/*************************************************************************************
; Function:	set capture resizer start y position
; Input:	Y start position of capture resizer
; Output:	None
; Format:	void CapStartYPosSet( unsigned short pos )
;*************************************************************************************/
void CapStartYPosSet( unsigned short pos )
{
	halWriteReg16( REG0966_CAP_RESIZE_START_Y_POS, pos );
}

/*************************************************************************************
; Function:	get capture resizer start y position
; Input:	None
; Output:	Y start position of capture resizer
; Format:	unsigned short CapStartYPosGet( void )
;*************************************************************************************/
unsigned short CapStartYPosGet( void )
{
	unsigned short pos = halReadReg16( REG0966_CAP_RESIZE_START_Y_POS );
	return ( pos );
}


/*************************************************************************************
; Function:	set capture resizer end x position
; Input:	X end position of capture resizer
; Output:	None
; Format:	void CapEndXPosSet( unsigned short pos )
;*************************************************************************************/
void CapEndXPosSet( unsigned short pos )
{
	halWriteReg16( REG0968_CAP_RESIZE_END_X_POS, pos );
}

/*************************************************************************************
; Function:	get capture resizer end x position
; Input:	None
; Output:	X end position of capture resizer
; Format:	unsigned short CapEndXPosGet( void )
;*************************************************************************************/
unsigned short CapEndXPosGet( void )
{
	unsigned short pos = halReadReg16( REG0968_CAP_RESIZE_END_X_POS );
	return ( pos );
}

/*************************************************************************************
; Function:	set capture resizer end y position
; Input:	Y end position of capture resizer
; Output:	None
; Format:	void CapEndYPosSet( unsigned short pos )
;*************************************************************************************/
void CapEndYPosSet( unsigned short pos )
{
	halWriteReg16( REG096A_CAP_RESIZE_END_Y_POS, pos );
}

/*************************************************************************************
; Function:	get capture resizer end y position
; Input:	None
; Output:	Y end position of capture resizer
; Format:	unsigned short CapEndYPosGet( void )
;*************************************************************************************/
unsigned short CapEndYPosGet( void )
{
	unsigned short pos = halReadReg16( REG096A_CAP_RESIZE_END_Y_POS );
	return ( pos );
}

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

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

/*************************************************************************************
; Function:	set capture resize scaling mode
; Input:	scalingMode
; Output:	None
; Format:	void CapScalingModeSet( ResizeScalingMode scalingMode )
;*************************************************************************************/
void CapScalingModeSet( ResizeScalingMode scalingMode )
{
	unsigned short capResizeOperation;
	scalingMode &= 0x0003;

	if (CapScalingRateGet() == 2 )
	{
		switch ( scalingMode )
		{
		case 3:
		case 5:
		case 6:
		case 7:
			return;
		}
	}

	capResizeOperation = halReadReg16( REG096E_CAP_RESIZE_OP1 );
	capResizeOperation &= (~0x0003);
	capResizeOperation |= (unsigned short)scalingMode;
	halWriteReg16( REG096E_CAP_RESIZE_OP1, capResizeOperation );
}

/*************************************************************************************
; Function:	get capture resize scaling mode
; Input:	None
; Output:	scalingMode
; Format:	ResizeScalingMode CapScalingModeGet( void )
;*************************************************************************************/
ResizeScalingMode CapScalingModeGet( void )
{
	ResizeScalingMode scalingMode = (ResizeScalingMode)halReadReg16( REG096E_CAP_RESIZE_OP1 );
	scalingMode  &= (ResizeScalingMode)0x0003;
	return ( scalingMode );
}










⌨️ 快捷键说明

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