📄 image_sensor.c
字号:
if (g_bVideoMode == KAL_TRUE) { // video preview mode
if (g_iBanding == CAM_BANDING_50HZ) {
ConfigVBlank(VIDEO_MODE_VBLANK_50HZ_NORMAL, CAM_BANDING_50HZ);
ConfigHBlank(VIDEO_MODE_HBLANK_50HZ_NORMAL, CAM_BANDING_50HZ);
write_cmos_sensor(0x33, VIDEO_MODE_FRCNT_50HZ_NORMAL);
write_cmos_sensor(0x34, VIDEO_MODE_STSTN_50HZ_NORMAL);
}else {
ConfigVBlank(VIDEO_MODE_VBLANK_60HZ_NORMAL, CAM_BANDING_60HZ);
ConfigHBlank(VIDEO_MODE_HBLANK_60HZ_NORMAL, CAM_BANDING_60HZ);
write_cmos_sensor(0x33, VIDEO_MODE_FRCNT_60HZ_NORMAL);
write_cmos_sensor(0x34, VIDEO_MODE_STSTN_60HZ_NORMAL);
}
}else { // camera preview mode
if (g_iBanding == CAM_BANDING_50HZ) {
ConfigVBlank(PV_MODE_VBLANK_50HZ_NORMAL, CAM_BANDING_50HZ);
ConfigHBlank(PV_MODE_HBLANK_50HZ_NORMAL, CAM_BANDING_50HZ);
write_cmos_sensor(0x33, PV_MODE_FRCNT_50HZ_NORMAL);
write_cmos_sensor(0x34, PV_MODE_STSTN_50HZ_NORMAL);
}else {
ConfigVBlank(PV_MODE_VBLANK_60HZ_NORMAL, CAM_BANDING_60HZ);
ConfigHBlank(PV_MODE_HBLANK_60HZ_NORMAL, CAM_BANDING_60HZ);
write_cmos_sensor(0x33, PV_MODE_FRCNT_60HZ_NORMAL);
write_cmos_sensor(0x34, PV_MODE_STSTN_60HZ_NORMAL);
}
}
}
/************************************************************
* After the above mode change setting, turn on AE again *
************************************************************/
write_cmos_sensor(0x40, g_iAE_Meter == CAM_AE_METER_AUTO ? 0x80 : 0xA0);
} /* SIV100A_NightMode */
/*************************************************************************
* FUNCTION
* SIV100A_SetFlash
*
* DESCRIPTION
* turn on/off SIV100A flashlight .
*
* PARAMETERS
* bEnable:
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
void SIV100A_SetFlash(kal_bool bEnable)
{
} /* SIV100A_SetFlash */
/*************************************************************************
* FUNCTION
* SIV100A_Set_Param_Zoom
*
* DESCRIPTION
* SIV100A zoom setting.
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV100A_Set_Para_Zoom(kal_uint32 iPara)
{
switch (iPara) {
case CAM_ZOOM_1X:
case CAM_ZOOM_2X:
case CAM_ZOOM_4X:
default:
return KAL_FALSE;
}
return KAL_FALSE;
} /* SIV100A_Set_Param_Zoom */
/*************************************************************************
* FUNCTION
* SIV100A_Set_Para_Contrast
*
* DESCRIPTION
* SIV100A contrast setting.
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV100A_Set_Para_Contrast(kal_uint32 iPara)
{
return KAL_FALSE;
} /* SIV100A_Set_Para_Contrast */
/*************************************************************************
* FUNCTION
* SIV100A_Set_Para_Brightness
*
* DESCRIPTION
* SIV100A brightness setting.
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV100A_Set_Para_Brightness(kal_uint32 iPara)
{
return KAL_FALSE;
} /* SIV100A_Set_Para_Brightness */
/*************************************************************************
* FUNCTION
* SIV100A_Set_Para_Hue
*
* DESCRIPTION
* SIV100A hue setting.
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV100A_Set_Para_Hue(kal_uint32 iPara)
{
return KAL_FALSE;
} /* SIV100A_Set_Para_Hue */
/*************************************************************************
* FUNCTION
* SIV100A_Set_Para_Gamma
*
* DESCRIPTION
* SIV100A gamma setting.
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV100A_Set_Para_Gamma(kal_uint32 iPara)
{
return KAL_FALSE;
} /* SIV100A_Set_Para_Gamma */
/*************************************************************************
* FUNCTION
* SIV100A_Set_Para_WB
*
* DESCRIPTION
* SIV100A WB setting.
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV100A_Set_Para_WB(kal_uint32 iPara)
{
/****************************************************************************
* camera_para.AWB.LightSource[m][n] is in 0x80 base, i.e. 0x80 = 1x gain *
****************************************************************************/
kal_uint16 iRGain = 0x80, iGGain = 0x80, iBGain = 0x80; // all set to 1x gain
// Fix AWB problem by Fordarm 060828
if (g_bCaptureMode == KAL_TRUE) {
return;
}
switch (iPara) {
case CAM_WB_AUTO: // enable AWB
// CAM_WB_AUTO mode should not update R/G/B gains
write_cmos_sensor(0x60, 0x90);
return KAL_TRUE;
case CAM_WB_CLOUD:
write_cmos_sensor(0x60, 0x00); // disable AWB
iRGain = camera_para.AWB.LightSource[0][1];
iGGain = camera_para.AWB.LightSource[0][2];
iBGain = camera_para.AWB.LightSource[0][3];
break;
case CAM_WB_DAYLIGHT:
write_cmos_sensor(0x60, 0x00); // disable AWB
iRGain = camera_para.AWB.LightSource[1][1];
iGGain = camera_para.AWB.LightSource[1][2];
iBGain = camera_para.AWB.LightSource[1][3];
break;
case CAM_WB_INCANDESCENCE:
write_cmos_sensor(0x60, 0x00); // disable AWB
iRGain = camera_para.AWB.LightSource[2][1];
iGGain = camera_para.AWB.LightSource[2][2];
iBGain = camera_para.AWB.LightSource[2][3];
break;
case CAM_WB_FLUORESCENT:
write_cmos_sensor(0x60, 0x00); // disable AWB
iRGain = camera_para.AWB.LightSource[3][1];
iGGain = camera_para.AWB.LightSource[3][2];
iBGain = camera_para.AWB.LightSource[3][3];
break;
case CAM_WB_TUNGSTEN:
write_cmos_sensor(0x60, 0x00); // disable AWB
iRGain = camera_para.AWB.LightSource[4][1];
iGGain = camera_para.AWB.LightSource[4][2];
iBGain = camera_para.AWB.LightSource[4][3];
break;
case CAM_WB_MANUAL:
default:
return KAL_FALSE;
}
write_cmos_sensor(0x7A, iRGain); // set R gain
write_cmos_sensor(0x7B, iBGain); // set B gain
write_cmos_sensor(0x7C, iGGain); // set G gain
return KAL_TRUE;
} /* SIV100A_Set_Para_WB */
/*************************************************************************
* FUNCTION
* SIV100A_Set_Para_EV
*
* DESCRIPTION
* SIV100A exposure setting.
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV100A_Set_Para_EV(kal_uint32 iPara)
{
switch (iPara) {
case CAM_EV_NEG_4_3: // -4 EV
write_cmos_sensor(0x41, 0x4A);
break;
case CAM_EV_NEG_3_3: // -3 EV
write_cmos_sensor(0x41, 0x5A);
break;
case CAM_EV_NEG_2_3: // -2 EV
write_cmos_sensor(0x41, 0x6A);
break;
case CAM_EV_NEG_1_3: // -1 EV
write_cmos_sensor(0x41, 0x7A);
break;
case CAM_EV_ZERO: // +0 EV
write_cmos_sensor(0x41, 0x8A);
break;
case CAM_EV_POS_1_3: // +1 EV
write_cmos_sensor(0x41, 0x9A);
break;
case CAM_EV_POS_2_3: // +2 EV
write_cmos_sensor(0x41, 0xAA);
break;
case CAM_EV_POS_3_3: // +3 EV
write_cmos_sensor(0x41, 0xBA);
break;
case CAM_EV_POS_4_3: // +4 EV
write_cmos_sensor(0x41, 0xCA);
break;
default:
return KAL_FALSE;
}
return KAL_TRUE;
} /* SIV100A_Set_Para_EV */
/*************************************************************************
* FUNCTION
* SIV100A_Set_Para_Banding
*
* DESCRIPTION
* SIV100A banding setting.
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV100A_Set_Para_Banding(kal_uint32 iPara)
{
g_iBanding = iPara;
switch (iPara) {
case CAM_BANDING_50HZ:
// all 50HZ blank register cannot be used
if (g_bVideoMode == KAL_TRUE) {
// ConfigVBlank(VIDEO_MODE_VBLANK_50HZ, CAM_BANDING_60HZ);
// ConfigHBlank(VIDEO_MODE_HBLANK_50HZ, CAM_BANDING_60HZ);
// write_cmos_sensor(0x34, 0x42);
// ConfigVBlank(VIDEO_MODE_VBLANK, CAM_BANDING_50HZ);
// ConfigHBlank(VIDEO_MODE_HBLANK, CAM_BANDING_50HZ);
}else {
}
break;
case CAM_BANDING_60HZ:
if (g_bVideoMode == KAL_TRUE) {
// ConfigVBlank(VIDEO_MODE_VBLANK_60HZ, CAM_BANDING_60HZ);
// ConfigHBlank(VIDEO_MODE_HBLANK_60HZ, CAM_BANDING_60HZ);
// write_cmos_sensor(0x34, 0x3A);
}else {
}
break;
default:
return KAL_FALSE;
}
return KAL_TRUE;
} /* SIV100A_Set_Para_Banding */
/*************************************************************************
* FUNCTION
* SIV100A_Set_Para_Saturation
*
* DESCRIPTION
* SIV100A SATURATION setting.
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV100A_Set_Para_Saturation(kal_uint32 iPara)
{
return KAL_FALSE;
} /* SIV100A_Set_Para_Saturation */
/*************************************************************************
* FUNCTION
* SIV100A_Set_Para_NightMode
*
* DESCRIPTION
* SIV100A night mode setting.
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV100A_Set_Para_NightMode(kal_uint32 iPara)
{
SIV100A_NightMode((kal_bool) iPara);
return KAL_TRUE;
} /* SIV100A_Set_Para_NightMode */
/*************************************************************************
* FUNCTION
* SIV100A_Set_Para_AE_Meter
*
* DESCRIPTION
* SIV100A AE metering mode
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV100A_Set_Para_AE_Meter(kal_uint32 iPara)
{
switch (iPara) {
case CAM_AE_METER_AUTO: // NORMAL mode AE metering
write_cmos_sensor(0x40, 0x80);
g_iAE_Meter = CAM_AE_METER_AUTO;
break;
case CAM_AE_METER_SPOT: // SPOT mode AE metering
write_cmos_sensor(0x40, 0xA0);
g_iAE_Meter = CAM_AE_METER_SPOT;
break;
case CAM_AE_METER_CENTRAL:
case CAM_AE_METER_AVERAGE:
default:
return KAL_FALSE;
}
return KAL_TRUE;
} /* SIV100A_Set_Para_AE_Meter */
/*************************************************************************
* FUNCTION
* SIV100A_Set_Para_Shutter_Priority
*
* DESCRIPTION
* SIV100A
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV100A_Set_Para_Shutter_Priority(kal_uint32 iPara)
{
return KAL_FALSE;
} /* SIV100A_Set_Para_Shutter_Priority */
/*************************************************************************
* FUNCTION
* SIV100A_Set_Para_Aperture_Priority
*
* DESCRIPTION
* SIV100A
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV100A_Set_Para_Aperture_Priority(kal_uint32 iPara)
{
return KAL_FALSE;
} /* SIV100A_Set_Para_Aperture_Priority */
/*************************************************************************
* FUNCTION
* SIV100A_Set_Para_ISO
*
* DESCRIPTION
* SIV100A
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV100A_Set_Para_ISO(kal_uint32 iPara)
{
switch (iPara) {
case CAM_ISO_AUTO:
case CAM_ISO_100:
case CAM_ISO_200:
case CAM_ISO_400:
default:
return KAL_FALSE;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -