📄 sensor.c
字号:
/*++
Copyright (c) 2001 Sunplus Technology Co., Ltd.
Module Name:
sensor.c
Abstract:
Module related to sensor
Environment:
Keil C51 Compiler
Revision History:
08/28/2001 Chi-Yeh Tsai created
--*/
//=============================================================================
//Header file
//=============================================================================
#include "general.h"
#include "sensor.h"
#include "main.h"
#include "ctlsetup.h"
#include "l1_3a.h"//patch4.4@jhyu@50/60HzTable
#include "unistd.h"
//=============================================================================
//Symbol
//=============================================================================
//-----------------------------------------------------------------------------
//Constant
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//Variable
//-----------------------------------------------------------------------------
xdata UCHAR G_Interlace_Enable; // 1 enable
// 0 disable
//Joe@2003.3.21 11:03 modify begin
//xdata UCHAR AEtype = 1;//1:60Hz, 0:50Hz //patch4.5@jhyu@60HzTable
xdata UCHAR AEtype = 0;//1:60Hz, 0:50Hz //patch4.5@jhyu@50HzTable
//Joe@2003.3.21 11:03 modify end
xdata UCHAR AEchangeflag;//patch4.5@jhyu@50/60HzTable
//patch4.2@richie@0516
extern xdata UCHAR K_AEAWB_Flag;
extern unsigned int AVG_LUM;
extern void UI_PrintOSDNumber(USHORT num, UCHAR x, UCHAR y, UCHAR fillbit);
void ChangeTable(int index);//patch4.4@jhyu@50/60HzTable
//=============================================================================
//Program
//=============================================================================
//----------------------------------------------------------------------------
//SENSOR_Initialize
//----------------------------------------------------------------------------
void SENSOR_Initialize(void) USING_0
/*++
Routine Description:
initialize sensor
Arguments:
none
Return Value:
none
--*/
{
G_Interlace_Enable = 0;
//hx@2003.6.2.del begin
//#################################################################################################
//There is no need to put this function here.
//#################################################################################################
#if (TURNKEY_OPTION == 0)
L1_InitPreview(0); //cytsai@0102
#endif
//hx@2003.6.2.del end
#if AAA_OPTION
//Joe@2003.3.18 20:29 mask begin
/*//Davis:patch4.0.0.1_2005/Jun/20 close
//richie@ae0305 strobe init
//charge output enable
XBYTE[0x2038] |= 0x08;
//ready output disable
XBYTE[0x2038] &= 0xef;
//strobe tri enable
XBYTE[0x2039] |= 0x10;
//led output enable
//XBYTE[0x203a] |= 0x08;
//led off
//XBYTE[0x2032] &= 0xf7;
//*/
//Joe@2003.3.18 20:29 mask end
#endif
}
//----------------------------------------------------------------------------
//SENSOR_CaptureAeAwbAf
//----------------------------------------------------------------------------
void SENSOR_CaptureAeAwbAf(void) USING_0
/*++
Routine Description:
do auto exposure and auto white balance prior to object capture
Arguments:
none
Return Value:
none
--*/
{
}
//----------------------------------------------------------------------------
//SENSOR_OrdinaryAeAwbAf
//----------------------------------------------------------------------------
void SENSOR_OrdinaryAeAwbAf(void) USING_0
/*++
Routine Description:
do auto exposure and auto white balance in ordinary time
Arguments:
none
Return Value:
none
--*/
{
//richie@ae0226
//pathc4.2@andrew@0520
UCHAR tmp;//Davis@05.3.3 add for debug
#if AAA_OPTION
if ((G_3AFlag==1))
{
if(AEchangeflag)//patch4.5@jhyu@50/60HzTable
{
ChangeTable(AEtype);//patch4.5@jhyu@50/60HzTable
AEchangeflag = 0;//patch4.5@jhyu@50/60HzTable
}
XBYTE[0x20D0] = XBYTE[0x20D0] & 0xDF;// ylee@0320 : Turn off VD falling interrupt
L1_3A(0);
#if DEBUG_COLOR
CMPGrGb(tmp);
if(tmp)
SetGrEqGb();//add for debug
#endif
//Jane@040901 for debug
// GetAvgLum(&AVG_LUM);
//UI_PrintOSDNumber(AVG_LUM, 5, 4, 4);
G_3AFlag = 0;
XBYTE[0X20D0] = XBYTE[0X20D0] | 0x20;// ylee@0320 : Turn on VD falling interrupt
}
#endif
}
//----------------------------------------------------------------------------
//SENSOR_GetColorInformation
//----------------------------------------------------------------------------
void SENSOR_GetColorInformation(USHORT colorIndex) USING_1
/*++
Routine Description:
get relative color information thru vendor command read
Arguments:
colorIndex - index of color information group
Return Value:
none
--*/
{
//ULONG i;
//For example
if (colorIndex == 0) //R/Gr/B/Gb offset for white balance
{
G_pucCtrlDataPointer[0] = XBYTE[0x2121]; //R offset
G_pucCtrlDataPointer[1] = XBYTE[0x2122]; //Gr offset
G_pucCtrlDataPointer[2] = XBYTE[0x2123]; //B offset
G_pucCtrlDataPointer[3] = XBYTE[0x2124]; //Gb offset
//for (i = 4; i < G_usCtrlDataLength; i++)
// G_pucCtrlDataPointer[i] = 0x00;
}
}
//----------------------------------------------------------------------------
//SENSOR_SetColorInformation
//----------------------------------------------------------------------------
void SENSOR_SetColorInformation(USHORT colorIndex) USING_1
/*++
Routine Description:
set relative color information thru vendor command write
Arguments:
colorIndex - index of color information group
Return Value:
none
--*/
{
//patch4.2@richie@0516 begin
if (colorIndex == 0)
{
if ((G_pucCtrlDataPointer[0] >= 0) && (G_pucCtrlDataPointer[0] <= 3))
{
K_AEAWB_Flag = G_pucCtrlDataPointer[0]; // andrew: vendor command control AE AWB disable or enable
//printf("K_AEAWB_Flag = %bx\n",K_AEAWB_Flag);
}
}
//patch4.2@richie@0516 end
else if(colorIndex == 8) //patch4.4@jhyu@50/60HzTable
{
if (G_pucCtrlDataPointer[0] == 2)
{
//printf("enter 60\n");
AEtype = 1;//patch4.5@jhyu@50/60HzTable
AEchangeflag = 1;//patch4.5@jhyu@50/60HzTable
//ChangeTable(1);//patch4.5@jhyu@50/60HzTable
}
else if (G_pucCtrlDataPointer[0] == 3)
{
//printf("enter 50\n");
AEtype = 0; //patch4.5@jhyu@50/60HzTable
AEchangeflag = 1;//patch4.5@jhyu@50/60HzTable
//ChangeTable(0);//patch4.5@jhyu@50/60HzTable
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -