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

📄 sensor.c

📁 Vc0558 backend IC COMS sensor drive program
💻 C
📖 第 1 页 / 共 5 页
字号:
	{0x64,	0x0f,	1},
	{0x65,	0x00,	1},
	{0x66,	0xaa,	1},
	{0x67,	0x00,	1},
	{0x68,	0x59,	1},
	{0x69,	0x80,	1},
	{0x6a,	0x71,	1},
	{0x6b,	0x80,	1},
	{0x6c,	0x04,	1},
	{0x6d,	0x04,	1},
	{0x6e,	0x00,	1},
	{0x6f,	0x00,	1},
	{0x70,	0x40,	1},
	{0x71,	0x00,	1},
	{0x72,	0x00,	1},
	{0x73,	0xee,	1},
	{0x74,	0x0e,	1},
	{0x75,	0xfa,	1},
	{0x76,	0x04,	1},
	{0x77,	0x17,	1},
	{0x78,	0xd9,	1},
	{0x7d,	0x30,	1},
	{0x7e,	0x6e,	1},
	{0x7f,	0x30,	1},
	{0x80,	0x00,	1},
	{0x81,	0x30,	1},
	{0x82,	0x00,	1},
	{0x83,	0x01,	1},
	{0x84,	0x00,	1},
	{0x85,	0xff,	1},
	{0x86,	0x00,	1},
	{0x87,	0x0f,	1},
	{0x88,	0x00,	1},
	{0x89,	0x16,	1},
	{0x8a,	0x00,	1},
	{0x8b,	0x28,	1},
	{0x8c,	0x00,	1},
	{0x8d,	0x41,	1},
	{0x8e,	0x00,	1},
	{0x8f,	0x64,	1},
	{0x90,	0x00,	1},
	{0x91,	0x87,	1},
	{0x92,	0x00,	1},
	{0x93,	0xb4,	1},
	{0x94,	0x00,	1},
	{0x95,	0x0f,	1},
	{0x96,	0x00,	1},
	{0x97,	0x16,	1},
	{0x98,	0x00,	1},
	{0x99,	0x28,	1},
	{0x9a,	0x00,	1},
	{0x9b,	0x41,	1},
	{0x9c,	0x00,	1},
	{0x9d,	0x64,	1},
	{0x9e,	0x00,	1},
	{0x9f,	0x87,	1},
	{0xa0,	0x00,	1},
	{0xa1,	0xb4,	1},
	{0xa2,	0x00,	1},
	{0xa3,	0x0f,	1},
	{0xa4,	0x00,	1},
	{0xa5,	0x16,	1},
	{0xa6,	0x00,	1},
	{0xa7,	0x28,	1},
	{0xa8,	0x00,	1},
	{0xa9,	0x41,	1},
	{0xaa,	0x00,	1},
	{0xab,	0x64,	1},
	{0xac,	0x00,	1},
	{0xad,	0x87,	1},
	{0xae,	0x00,	1},
	{0xaf,	0xb4,	1},
	{0xb0,	0x00,	1},
	{0xb1,	0x00,	1},
	{0xb2,	0x14,	1},
	{0xb3,	0x23,	1},
	{0xb4,	0x50,	1},
	{0xb5,	0x78,	1},
	{0xb6,	0x9e,	1},
	{0xb7,	0xc3,	1},
	{0xb8,	0xe1,	1},
	{0xb9,	0xff,	1},
	{0xba,	0x00,	1},
	{0xbb,	0x14,	1},
	{0xbc,	0x23,	1},
	{0xbd,	0x50,	1},
	{0xbe,	0x78,	1},
	{0xbf,	0x9e,	1},
	{0xc0,	0xc3,	1},
	{0xc1,	0xe1,	1},
	{0xc2,	0xff,	1},
	{0xc3,	0x00,	1},
	{0xc4,	0x14,	1},
	{0xc5,	0x23,	1},
	{0xc6,	0x50,	1},
	{0xc7,	0x78,	1},
	{0xc8,	0x9e,	1},
	{0xc9,	0xc3,	1},
	{0xca,	0xe1,	1},
	{0xcb,	0xff,	1},
	{0xcc,	0x0b,	1},
	{0xcd,	0x40,	1},
	{0xce,	0x10,	1},
	{0xcf,	0x00,	1},
	{0xd0,	0xaa,	1},
	{0xd1,	0x00,	1},
	{0xd2,	0x0a,	1},
	{0xd3,	0x40,	1},
	{0xd4,	0x07,	1},  //07@50Hz;08@60Hz
	{0xd5,	0x30,	1},
	{0xd6,	0x00,	1},
	{0xd7,	0x08,	1},
	{0xd8,	0x08,	1},
	{0xd9,	0x12,	1},
	{0xda,	0x60,	1},
	{0xdf,	0x02,	1},
	{0xe0,	0x13,	1},
	{0xe1,	0x44,	1},
	{0xe2,	0xd0,	1},
	{0xe3,	0x40,	1},
	{0xe4,	0xc0,	1},
	{0xe5,	0x40,	1},
	{0xe6,	0xc0,	1},
	{0xe7,	0x00,	1},
	{0xe8,	0x80,	1},
	{0xe9,	0x00,	1},
	{0xea,	0x00,	1},
	{0xeb,	0x80,	1},
	{0xec,	0x00,	1},
	{0xed,	0x7e,	1},
	{0xee,	0xe1,	1},
	{0xef,	0x00,	1},
	{0xf0,	0xff,	1},
	{0xf1,	0x00,	1},
	{0xf2,	0xff,	1},
	{0xf3,	0x00,	1},
	{0xf4,	0xff,	1},
	{0xf7,	0x20,	1}
};

const V558_SENSORINFO SensorInfo = 
{

	"Fujitsu MBS03 YUV mode",
	{640, 480},


	1,		//yuv mode
	0x1,	//pixel rate
	0x1,	//sensor mast clock count
	12000,	//sif clock
	V558_SNRC_I2C,
	FUJITSU_MBS03,
	{1,1,0,0,1},
	{sizeof(SifRegVal) / sizeof(V558_SENSORREGVALUE), SifRegVal},
	{0, 0xc0, 0, sizeof(SensorRegVal) / sizeof(V558_SENSORREGVALUE), SensorRegVal},
	{
		0xc8, sizeof(IspRegVal) / sizeof(V558_SENSORREGVALUE), 
		IspRegVal,
		{
			//tgt, yfldstp,lck,ulck,gain,gadly,gmax,gainrange[4],yfldmstp,steptime,inlck, gmin, etdem, etnum,reserved1,2,3;
			{0x78, 0x40, 0x0a, 0x14, 0x60, 1, 0xe0, {0x20, 0x20, 0xb, 0x10}, 0x20, 4, 0, 0x20, 4, 3, 0, 0, 0},	//ae
			//flkcnt,flklinemode,flkstep,flklst,outthd,lighttype,freqtype,timeinout,reserved1,2
			{0x39   ,0x1        ,0x0    ,0xd0  ,3     ,0        ,FREQ    , 98, 0, 0},	//aflk
			//enae,enflk,intfrq,maxexp,defexp,minexp,exppoint,dpcthd,enlight,reserved1,2
			1, AUTO_FLK, 0     ,1000  ,400   ,80    ,1000    ,1000    ,1      ,0,0
		},
		{
			32, 32 //brightness
		},
		{
			0x00,0x13,0x38,0x59,0x79,0x92,0xa7,0xb9,0xc8,0xd4,0xdf,0xe7,0xee,0xf4,0xf9,0xfc,0xff	//gamma table
		}
	}
};

/********************************************************************************
  Description:	Write sensor register to change exposure time
  Parameter: t -- exposure time clock num 
*********************************************************************************/
void V558_SifSetSnrTime(UINT8 freqtype, UINT32 t)
{
}

/********************************************************************************
  Description:	Write sensor register when change freq
  Parameter: freqflag -- freq type (0)50hz,else 60hz 
*********************************************************************************/
void V558_SifSetFlkParam(UINT8 freqflag)
{
}
#endif



#if SELECT_FUJITSU_MBS04_BAYER

const V558_SENSORREGVALUE SifRegVal[] =
{
//	{0x800, 	0x24, 1},
//	{0x800, 	0x21, 1},
//	{0x805, 	0x00, 0},
//	{0x806, 	0x01, 0},
	{0x803,  0x1b, 0},
	{0x804,  0x04, 0},
	{0x801, 	0x05, 0},
	{0x814, 	0x00, 0},
	{0x815,  0x00, 0},
	{0x816, 	0x02, 0},
	{0x817,  0x7f, 0},
	{0x820,  0x00, 0},
	{0x821,  0x01, 0},
	{0x822,  0x01, 0},
	{0x823,  0xe1, 0},
//	{0x81c,  0x00, 0},
//	{0x81d, 	0x01, 0},
//	{0x81e,  0x00, 0},
//	{0x81f,  0x08, 0},
 
	{0x840, 	0x01, 0},
	{0x841, 	0xd0, 0},
	{0x842, 	0x01, 0},
	{0x843, 	0xe0, 0}
 
//	{0x800, 	0x27, 0}
};
 
const V558_SENSORREGVALUE SensorRegVal[] =
{
	
	{0x1, 0x00, 1},
	{0x2, 0x00, 1},
	{0x3, 0x01, 1},
	{0x4, 0xa4, 1},
	
	{0x5, 0x07, 1},
	{0x6, 0x00, 1},
	{0x7, 0x84, 1},
	{0x8, 0x20, 1},
	{0x9, 0x18, 1},
	{0xa, 0x00, 1},
	{0xb, 0x00, 1},
	{0xc, 0x03, 1},
	{0xd, 0x03, 1},
	{0xe, 0xf4, 1},
	{0xf, 0x59, 1},
	
	{0x10, 0x02, 1},
	{0x11, 0x0c, 1},
//	{0x12, 0x70, 1},
//	{0x13, 0x85, 1},
	
	{0x12, 0xe0, 1},
	{0x13, 0x05, 1},
	{0x14, 0xf4, 1},
	{0x15, 0x10, 1},
	{0x16, 0x00, 1},
//	{0x16, 0x04,	1},
	{0x17, 0x00, 1},
	{0x18, 0xff, 1},
	{0x19, 0x00, 1},
//	{0x1a, 0xc2,	1},
//	{0x1b, 0x0,	1},
	
	{0x1a, 0xe3, 1},
	{0x1b, 0x70, 1},
	{0x1c, 0x00, 1},
	{0x1d, 0x00, 1},
	{0x1e, 0x00, 1},
	{0x1f, 0x00, 1}
};



const V558_SENSORREGVALUE IspRegVal[] =
{
	{0x2000, 0x31, 0},
		
	{0x2001, 0x5d, 0},
	
	{0x2027, 0x20, 0},
	{0x2026, 0x60, 0},
	
	{0x200a, 0x80, 0},
	{0x200b, 0xc0, 0},
	{0x200c, 0x05, 0},
	{0x200d, 0x0f, 0},
	{0x200e, 0x0f, 0},
	{0x200f, 0x0f, 0},
	
	{0x2022, 0x60, 0},
	{0x2023, 0x60, 0},
	{0x2024, 0x60, 0},
	
	{0x202c, 0x60, 0},
	{0x202d, 0xf0, 0},
	{0x202e, 0xf0, 0},
	{0x202f, 0xf0, 0},
	{0x2030, 0x60, 0},
	{0x2031, 0xf0, 0},
	{0x2032, 0xf0, 0},
	{0x2033, 0xf0, 0},
	{0x2034, 0x60, 0},
	
	{0x2035, 0x00, 0},
	{0x2036, 0x00, 0},
	{0x2037, 0x00, 0},
	
	{0x208b, 0xff, 0},
//	{0x208c, 0xff, 0},
//	{0x208d, 0xff, 0},
	{0x2081, 0x01, 0}
	
};


const V558_SENSORINFO SensorInfo = 
{
	
	"Fujitsu MBS04 RGB mode",
	{640, 480},
	
	0,  //RGB mode
	0x1, //pixel rate
	0x0, //sensor mast clock count
	12000, //sif clock
	V558_SNRC_I2C,
	FUJITSU_MBS04_BAYER,
	{1,1,0,0,1},
	{sizeof(SifRegVal) / sizeof(V558_SENSORREGVALUE), SifRegVal},
	{0, 0xc0, 0, sizeof(SensorRegVal) / sizeof(V558_SENSORREGVALUE), SensorRegVal},
	{
		0x0, sizeof(IspRegVal) / sizeof(V558_SENSORREGVALUE), 
			IspRegVal,
			
		{
			//tgt, yfldstp,lck,ulck,gain,gadly,gmax,gainrange[4],yfldmstp,steptime,inlck, gmin, etdem, etnum,reserved1,2,3;
			{0x78, 0x40, 0x09, 0x10, 0x60, 1, 0xe0, {0x18, 0x14, 0x10, 0x8}, 0x20, 4, 0, 0x40, 4, 3, 0, 0, 0}, //ae
			//flkcnt,flklinemode,flkstep,flklst,outthd,lighttype,freqtype,timeinout,reserved1,2
			{0x39   ,0x1        ,0x0    ,0xd0  ,2     ,0        ,FREQ    , 98, 0, 0}, //aflk
			//enae,enflk,intfrq,maxexp,defexp,minexp,exppoint,dpcthd,enlight,reserved1,2
			1, AUTO_FLK, 0     ,300  ,200   ,80    ,300    ,300    ,1      ,0,0
		},
		{
				40, 40 //brightness
			},
			{
					0x00,0x00,0x09,0x1a,0x32,0x4a,0x64,0x7d,0x95,0xaa,0xbd,0xcd,0xdb,0xe7,0xf1,0xf9,0xff
					//0x00,0x04,0x16,0x30,0x4e,0x68,0x81,0x98,0xac,0xbe,0xcd,0xda,0xe4,0xed,0xf5,0xfb,0xff //gamma table
					//0x00,0x02,0x0f,0x25,0x41,0x5b,0x74,0x8c,0xa2,0xb6,0xc6,0xd5,0xe1,0xeb,0xf3,0xfa,0xff
					//0x00,0x01,0x0c,0x1f,0x3a,0x53,0x6d,0x85,0x9c,0xb0,0xc2,0xd1,0xde,0xe9,0xf2,0xf9,0xff //gamma table
			}
	}
};

/********************************************************************************
Description: Write sensor register to change exposure time
Parameter: t -- exposure time clock num 
*********************************************************************************/
void V558_SifSetSnrTime(UINT8 freqtype, UINT32 t)
{
	UINT16 uTemp = 0;
	
	V558_I2C_BATCH AeData;
	
	uTemp = (UINT16)(t/858); 
	AeData.RegBytes = 2;
	AeData.RegAddr = 0x3;
	AeData.RegVal[0]= (UINT8)(uTemp>>8);
	AeData.RegVal[1]= (UINT8)(uTemp);
	V558_SifI2cAeBatch(1, &AeData);
}

/********************************************************************************
  Description:	Write sensor register to change exposure sensor gain
  Parameter: gain -- gain 
*********************************************************************************/
void V558_SifSetSnrGain(UINT8 gain)
{
	V558_SifI2cWriteByte(0x05, gain); 
}

/********************************************************************************
Description: Write sensor register when change freq
Parameter: freqflag -- freq type (0)50hz,else 60hz 
*********************************************************************************/
void V558_SifSetFlkParam(UINT8 freqflag)
{
}

#endif



#if SELECT_OV_7649_BAYER

const V558_SENSORREGVALUE	SifRegVal[] =
{
//	{0x800, 0x25,	1},
//	{0x800, 0x24,	1},
//	{0x805, 0x00,	0},
//	{0x806, 0x01,	0},
	{0x801, 0x05,	0},
	{0x803, 0x1b,	0},
	{0x804, 0x05,	0},
	{0x814, 0x00,	0},
	{0x815, 0x00,	0},
	{0x816, 0x02,	0},

	{0x817, 0x7f,	0},
	{0x820, 0x00,	0},
	{0x821, 0x00,	0},
	{0x822, 0x01,	0},
	{0x823, 0xe0,	0},
	{0x81c, 0x00,	0},
	{0x81d, 0x01,	0},
	{0x81e, 0x00,	0},
	{0x81f, 0x02,	0},

	{0x840, 0x1,	0},
	{0x841, 0xd0,	0},
	{0x842, 0x1,	0},
	{0x843, 0xe0,	0}

//	{0x800, 0x26,	0}
};

const V558_SENSORREGVALUE	SensorRegVal[] =
{
	{0x12,	0x80,	10},
	{0x03,	0x64,	1}, //a4
	{0x04,	0x30,	1},
	{0x05,	0x08,	1},
	{0x06,	0x60,	1},
	{0x12,	0x49,	1}, 
	{0x13,	0xa0,	1},//a3
	{0x14,	0x00,	1},
	{0x15,	0x04,	1},
	{0x17,	0x18,	1},
	{0x18,	0xba,	1},
	{0x19,	0x03,	1},
	{0x1a,	0xf3,	1},
	{0x1f,	0x40,	1},
	{0x20,	0x80,	1},//c0
	{0x23,	0xde,	1},
	{0x24,	0x80,	1},
	{0x25,	0x68,	1},
	{0x26,	0xc0,	1},//32
	{0x27, 	0xf2,	1},
////{0x27, 	0xf6, 	1},
	{0x28,	0xa0,	1},
	
	{0x2a,	0x95,	1},
	{0x2b,	0x00,	1},

	{0x2d,	0x05,	1},//05
	{0x2f, 	0x9d, 	1},
	{0x30,	0x00,	1},
	{0x31,	0xc4,	1},
	
	{0x60, 	0xa6, 	1},//a6
	{0x61, 	0x60, 	1},//68
	{0x63,	0x11,	1},
	{0x64,	0x88,	1},
	{0x65,	0x00,	1},
	{0x67,	0x94,	1},
	{0x68, 	0x7a, 	1},
//// {0x68, 	0x7b, 	1},
	{0x69,	0x04,	1},
	{0x6c,	0x11,	1},
	{0x6d,	0x33,	1},
	{0x6e,	0x22,	1},
	{0x6f,	0x00,	1},
	{0x74, 	0x20, 	1},//20
	{0x75, 	0x0e, 	1},//8e

	 
	{0x77,	0xb5,	1},
	{0x01,	0x80,	1},
	{0x02,	0x80,	1},

	{0x26,	0xc2,	1},//add by zhangqi
	{0x21,	0x85,	1},//add by zhangqi
	{0x22,	0x85,	1},//add by zhangqi
	{0x2e,	0x85,	1},//add by zhangqi
};


const V558_SENSORREGVALUE	IspRegVal[] =
{
	{0x2000,	0x21,	0},
	{0x2001,	0x7d,	0},
	{0x2027,	0x20,	0},
//	{0x2026,	0x43,	0},
	
	{0x200a,	0x40,	0},
	{0x200b,	0x60,	0},
	{0x200c,	0x05,	0},
	{0x200d,	0x0f,	0},
	{0x200e,	0x0f,	0},
	{0x200f,	0x0f,	0},

	{0x2022,	0x2a,	0},//1D
	{0x2023,	0x40,	0},//40
	{0x2024,	0x60,	0},//af

	{0x202c,	0x60,	0}, //for D65
	{0x202d,	0xde,	0},
	{0x202e,	0x09,	0},
	{0x202f,	0xf1,	0},
	{0x2030,	0x5f,	0},
	{0x2031,	0xf4,	0},
	{0x2032,	0xf1,	0},
	{0x2033,	0xe5,	0},
	{0x2034,	0x68,	0},

/*
	{0x202c,	0x4b,	0},// for Tl84
	{0x202d,	0xed,	0},
	{0x202e,	0x11,	0},
	{0x202f,	0x06,	0},
	{0x2030,	0x40,	0},
	{0x2031,	0xfd,	0},
	{0x2032,	0x05,	0},
	{0x2033,	0x09,	0},
	{0x2034,	0x31,	0},
	
	{0x202c, 0x60, 	0},//for Incandescent
	{0x202d, 0xf0, 	0},
	{0x202e,	0xf0,	0},
	{0x202f, 0xf0, 	0},
	{0x2030, 0x60, 	0},
	{0x2031, 0xf0, 	0},
	{0x2032, 0xf0, 	0},
	{0x2033,	0xf0, 	0},
	{0x2034,	0x60, 	0},

	{0x202c,	0x57,	0}, //for Incandescent1
	{0x202d,	0x0b,	0},
	{0x202e,	0xe0,	0},
	{0x202f,	0xf2,	0},
	{0x2030,	0x49,	0},
	{0x2031,	0x01,	0},
	{0x2032,	0xfe,	0},
	{0x2033,	0xa8,	0},
	{0x2034,	0x7f,	0},		
*/
	{0x2035,	0x00,	0},
	{0x2036,	0x00,	0},
	{0x2037,	0x00,	0}, 
	
	{0x208b,	0xff,	0},
//	{0x208c, 0x10, 	0},
//	{0x208d, 0x18, 	0},
//	{0x208e, 0x10, 	0},
//	{0x208f, 0x50, 	0},
	{0x2081,	0x01,	0}

};

const V558_SENSORINFO SensorInfo = 
{
	"ov7649 bayer mode",
	{640, 480},
	0,		//bayer mode
	0x1,	//pixel rate
	0x0,	//sensor mast clock count
	12000,	//sif clock
	V558_SNRC_I2C,
	OV7649_BAYER,

	{1,1,0,0,0},

⌨️ 快捷键说明

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