📄 sensor.c
字号:
{sizeof(SifRegVal) / sizeof(V558_SENSORREGVALUE), SifRegVal},
{0, 0x42, 0, sizeof(SensorRegVal) / sizeof(V558_SENSORREGVALUE), SensorRegVal},
{
0x42, 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, 0x80, {0x20, 0x20, 0xb, 0x10}, 0x20, 6, 8, 0x40, 10, 9, 0, 0, 0}, //ae
//flkcnt,flklinemode,flkstep,flklst,outthd,lighttype,freqtype,timeinout,reserved1,2
{0x39 ,0x1 ,0x0 ,0xd0 ,3 ,0 ,FREQ , 94, 0, 0}, //aflk
//enae,enflk,intfrq,maxexp,defexp,minexp,exppoint,dpcthd,enlight,reserved1,2
1, 1, 0 ,2500 ,400 ,57 ,1000 ,1000 ,1 ,0,0
},
{
32, 32//brightness
},
{
0x00,0x04,0x16,0x30,0x4e,0x68,0x81,0x98,0xac,0xbe,0xcd,0xda,0xe4,0xed,0xf5,0xfb,0xff //gamma table
//0x00,0x13,0x38,0x59,0x79,0x92,0xa7,0xb9,0xc8,0xd4,0xdf,0xe7,0xee,0xf4,0xf9,0xfc,0xff
}
}
};
/********************************************************************************
Description: Write sensor register to change exposure time
Parameter: t -- exposure time clock num
*********************************************************************************/
void V558_SifSetSnrTime(UINT8 freqtype, UINT32 t)
{
UINT16 uTemp = 0;
UINT16 vBlank = 0;
UINT16 times = 0;
V558_I2C_BATCH AeData;
if(freqtype) //60hz
{
times = t/100000;
if(times >4)
{
uTemp = 525;
vBlank = t/764-525;
}
else
{
uTemp = t/764;
vBlank = 0x00;
}
}
else //50hz
{
times = t/120000;
if(times >3)
{
uTemp = 525;
vBlank = t/764-525;
}
else
{
uTemp = t/764;
vBlank = 0x00;
}
}
if(uTemp < 1)
{
uTemp = 1;
}
V558_SifI2cWriteByte(0x16,(UINT8)(vBlank&0xff));
V558_SifI2cWriteByte(0x1e,(UINT8)((vBlank&0xff00)>>8));
V558_SifI2cWriteByte(0x76,(UINT8)(uTemp&0x03));
// V558_Delay(10);
AeData.RegBytes = 1;
AeData.RegAddr = 0x10;
AeData.RegVal[0]= (UINT8)(uTemp>>2);
V558_SifI2cAeBatch(1, &AeData);
// V558_SifI2cWriteByte(0x10,(UINT8)(uTemp>>2));
}
/********************************************************************************
Description: Write sensor register when change freq
Parameter: freqflag -- freq type (0)50hz,else 60hz
*********************************************************************************/
void V558_SifSetFlkParam(UINT8 freqflag)
{
/*
if(freqflag) //60hz
{
V558_SifI2cWriteByte(0x2a, 0x11);
V558_SifI2cWriteByte(0x2b, 0x00);
}
else //50hz
{
V558_SifI2cWriteByte(0x2a, 0x91);
V558_SifI2cWriteByte(0x2b, 0x98);
}
*/
}
#endif
#if SELECT_HYNIX7131R_BAYER
const V558_SENSORREGVALUE SifRegVal[] =
{
// {0x800, 0x24, 1},
// {0x800, 0x25, 1},
// {0x805, 0x00, 0},
// {0x806, 0x01, 0},
{0x801, 0x01, 0},
{0x803, 0x0b, 0},
{0x804, 0x05, 0},
{0x814, 0x00, 0},
{0x815, 0x04, 0},
{0x816, 0x02, 0},
{0x817, 0x7f, 0},
{0x820, 0x00, 0},
{0x821, 0x00, 0},
{0x822, 0x01, 0},
{0x823, 0xe0, 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[] =
{
{0x01, 0x0c, 1},
{0x14, 0x01, 1},
{0x15, 0xe6, 1},
{0x16, 0x02, 1},
{0x17, 0x86, 1},
{0x19, 0x00, 1},
{0x25, 0x07, 1},
{0x26, 0x53, 1},
{0x27, 0x00, 1},
// {0x30, 0x2D, 1},
// {0x30, 0x10, 1},
{0x31, 0x18, 1},
{0x32, 0x18, 1},
{0x33, 0x18, 1},
{0x35, 0x63, 1},
{0x40, 0xe0, 1},
};
const V558_SENSORREGVALUE IspRegVal[] =
{
{0x2001, 0x7d, 0},
{0x2027, 0x20, 0},
{0x2026, 0x60, 0},
{0x200a, 0x40, 0},
{0x200b, 0x60, 0},
{0x200c, 0x05, 0},
{0x200d, 0x0f, 0},
{0x200e, 0x05, 0},
{0x200f, 0x0f, 0},
{0x2022, 0x57, 0},
{0x2023, 0x40, 0},
{0x2024, 0x44, 0},
{0x202c, 0x66, 0},
{0x202d, 0xed, 0},
{0x202e, 0xed, 0},
{0x202f, 0xed, 0},
{0x2030, 0x66, 0},
{0x2031, 0xed, 0},
{0x2032, 0xed, 0},
{0x2033, 0xed, 0},
{0x2034, 0x66, 0},
{0x2000, 0x21, 0},
// {0x208b, 0xff, 0},
// {0x208c, 0xc0, 0},
{0x208d, 0xa0, 0},
{0x2081, 0x01, 0}
};
const V558_SENSORINFO SensorInfo =
{
"Hynix7131R bayer mode",
{640, 480},
0, //bayer mode
0x1, //pixel rate
0x0, //sensor mast clock count
12000, //sif clock
V558_SNRC_I2C,
HYNIX7131R_BAYER,
{0,1,0,0,1},
{sizeof(SifRegVal) / sizeof(V558_SENSORREGVALUE), SifRegVal},
{0, 0x22, 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;
{0x70, 0x40, 0x0a, 0x14, 0x60, 1, 0xe0, {0x20, 0x20, 0xb, 0x10}, 0x20, 4, 0, 0x40, 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 ,2000 ,400 ,80 ,1000 ,1000 ,1 ,0,0
},
{
32, 32 //brightness
},
{
//0x00,0x04,0x16,0x30,0x4e,0x68,0x81,0x98,0xac,0xbe,0xcd,0xda,0xe4,0xed,0xf5,0xfb,0xff
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)
{
V558_I2C_BATCH AeData;
AeData.RegBytes = 3;
AeData.RegAddr = 0x25;
AeData.RegVal[0]= (UINT8)(t>>16);
AeData.RegVal[1]= (UINT8)(t>>8);
AeData.RegVal[2]= (UINT8)t;
V558_SifI2cAeBatch(1, &AeData);
}
/********************************************************************************
Description: Write sensor register when change freq
Parameter: freqflag -- freq type (0)50hz,else 60hz
*********************************************************************************/
void V558_SifSetFlkParam(UINT8 freqflag)
{
}
#endif
#if SELECT_MI360_BAYER
const V558_SENSORREGVALUE SifRegVal[] =
{
// {0x800, 0x04, 1},
// {0x800, 0x05, 1},
{0x801, 0x01, 0},
{0x803, 0x09, 0},
{0x804, 0x05, 0},
// {0x805, 0x00, 0},
// {0x806, 0x01, 0},
{0x815, 0x00, 0},
{0x816, 0x02, 0},
{0x817, 0x7f, 0},
{0x821, 0x00, 0},
{0x823, 0xe0, 0},
{0x81d, 0x01, 0},
{0x81f, 0x06, 0},
{0x834, 0x02, 0},
{0x835, 0xdd, 0},
{0x840, 0x1, 0},
{0x841, 0xd0, 0},
{0x842, 0x1, 0},
{0x843, 0xe0, 0}
// {0x800, 0x27, 10}
};
const V558_SENSORREGVALUE SensorRegVal[] =
{
{0x01, 0x0006, 1},
{0x02, 0x0011, 1},
{0x03, 0x01e5, 1},
{0x04, 0x0285, 1},
{0x06, 0x0003, 1},
{0x07, 0x3002, 1},//add
// {0x20, 0x1000, 1},
{0x20, 0x1100, 1},//add
{0x35, 0x0050, 1},//add by liuyong
// {0x30, 0x0006, 1},
// {0x31, 0x002a, 1},
// {0x31, 0x002a, 1},
{0x30, 0x0005, 1},//add
{0x31, 0x0000, 1},//add
{0x34, 0x0100, 1},//add
{0x3d, 0x068f, 1},//add
{0x40, 0x01e0, 1},//add
{0x58, 0x0078, 1},
// {0x62, 0x0418, 1},
{0x62, 0x0411, 1},//add
{0x05, 0x005c, 1},//liuyong
// {0x09, 0x0093, 1},
{0x2b, 0x0040, 1},//add by ZhangQi
{0x2c, 0x0040, 1},//add by ZhangQi
{0x2d, 0x0040, 1},//add by ZhangQi
{0x2e, 0x0040, 1},//add by ZhangQi
};
const V558_SENSORREGVALUE IspRegVal[] =
{
{0x2000, 0x01, 0},
{0x2001, 0x7d, 0},
{0x2027, 0x20, 0},
{0x2026, 0x70, 0},
{0x200a, 0x40, 0},
{0x200b, 0x60, 0},
{0x200c, 0x05, 0},
{0x200d, 0x0f, 0},
{0x200e, 0x05, 0},
{0x200f, 0x0f, 0},
{0x2022, 0x60, 0},
{0x2023, 0x60, 0},
{0x2024, 0x60, 0},
{0x202c, 0x50, 0},
{0x202d, 0xf8, 0},
{0x202e, 0xf8, 0},
{0x202f, 0xf8, 0},
{0x2030, 0x50, 0},
{0x2031, 0xf8, 0},
{0x2032, 0xf8, 0},
{0x2033, 0xf8, 0},
{0x2034, 0x50, 0},
// {0x202c, 0x48, 0},
// {0x202d, 0x01, 0},
// {0x202e, 0x02, 0},
// {0x202f, 0xfe, 0},
// {0x2030, 0x42, 0},
// {0x2031, 0x01, 0},
// {0x2032, 0xf5, 0},
// {0x2033, 0xe7, 0},
// {0x2034, 0x66, 0},
{0x208b, 0xff, 0},
// {0x208c, 0xff, 0},
// {0x208d, 0xff, 0},
{0x2081, 0x01, 0}
};
const V558_SENSORINFO SensorInfo =
{
"Mi360 bayer mode",
{640, 480},
0, //bayer mode
0x1, //pixel rate
0x0, //sensor mast clock count
12000, //sif clock
V558_SNRC_I2C,
MI360_BAYER,
{0,1,0,0,1},
{sizeof(SifRegVal) / sizeof(V558_SENSORREGVALUE), SifRegVal},
{0, 0xBA, 1, sizeof(SensorRegVal) / sizeof(V558_SENSORREGVALUE), SensorRegVal},
{
0xBA, 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, 0x70, 1, 0xe0, {0x20, 0x20, 0xb, 0x10}, 0x20, 4, 0, 0x40, 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 ,2000 ,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)
{
UINT16 uTemp = 0;
V558_I2C_BATCH AeData;
uTemp = (t+112)/(0x355);
AeData.RegBytes = 2;
AeData.RegAddr = 0x9;
AeData.RegVal[0]= (UINT8)(uTemp>>8);
AeData.RegVal[1]= (UINT8)uTemp;
V558_SifI2cAeBatch(1, &AeData);
}
/********************************************************************************
Description: Write sensor register when change freq
Parameter: freqflag -- freq type (0)50hz,else 60hz
*********************************************************************************/
void V558_SifSetFlkParam(UINT8 freqflag)
{
}
#endif
#if SELECT_MI360_YUV
const V558_SENSORREGVALUE SifRegVal[] =
{
// {0x800, 0x64, 1},
// {0x800, 0x65, 1},
{0x801, 0x41, 0},
{0x802, 0x01, 0},
{0x803, 0x09, 0},
{0x804, 0x05, 0},
// {0x805, 0x01, 0},
// {0x806, 0x01, 0},
{0x815, 0x00, 0},
{0x816, 0x02, 0},
{0x817, 0x7f, 0},
{0x821, 0x00, 0},
{0x823, 0xe0, 0},
{0x81d, 0x01, 0},
{0x81f, 0x02, 0},
{0x834, 0x02, 0},
{0x835, 0xdc, 0},
// {0x800, 0x67 0}
};
const V558_SENSORREGVALUE SensorRegVal[] =
{
{0x01, 0x0004, 1},
{0x08, 0x0006, 1},
{0x02, 0x0012, 1},
{0x03, 0x01e7, 1},
{0x04, 0x0287, 1},
{0x05, 0x002e, 1},
{0x06, 0x0003, 1},
{0x07, 0x3012, 1},
{0x20, 0xd100, 1},
{0x35, 0x0050, 1},
{0x58, 0x0078, 1},
{0x62, 0x0411, 1},
{0x09, 0x0093, 1},
{0x2c, 0x0010, 1},
{0x2d, 0x0010, 1},
{0x01, 0x0001, 1},
{0x08, 0xc900, 1},
{0x25, 0x4324, 1},
// {0x2e, 0x1078, 1},
// {0x2f, 0x0040, 1},
// {0x34, 0x0000, 1},
{0x35, 0xd010, 1},
{0x36, 0x6010, 1},
{0x53, 0x0904, 1},
{0x54, 0x2412, 1},
{0x55, 0x6c48, 1},
{0x56, 0xb591, 1},
{0x57, 0xfed9, 1},
};
const V558_SENSORREGVALUE IspRegVal[] =
{
{0x00, 0x00, 1},
};
const V558_SENSORINFO SensorInfo =
{
"Mi360 YUV mode",
{640, 480},
1, //bayer mode
0x1, //pixel rate
0x1, //sensor mast clock count
12000, //sif clock
V558_SNRC_I2C,
MI360_YUV,
{1,1,0,0,1},
{sizeof(SifRegVal) / sizeof(V558_SENSORREGVALUE), SifRegVal},
{0, 0xB8, 1, sizeof(SensorRegVal) / sizeof(V558_SENSORREGVALUE), SensorRegVal},
{
0xB8, 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_OV_7649_YUV
const V558_SENSORREGVALUE SifRegVal[] =
{
// {0x800, 0x65, 1},
// {0x800, 0x64, 1},
// {0x805, 0x01, 0},
// {0x806, 0x01, 0},
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -