LOCAL uint32_t Set_GT2005_Anti_Flicker(uint32_t mode)
{ 
        //PLL Setting 15FPS Under 19.5MHz PCLK
        Sensor_WriteReg(0x0116 , 0x01);
        Sensor_WriteReg(0x0118 , 0x34);
        Sensor_WriteReg(0x0119 , 0x01);
        Sensor_WriteReg(0x011a , 0x04);	
        Sensor_WriteReg(0x011B , 0x01);
        Sensor_WriteReg(0x0313 , 0x34); 
        Sensor_WriteReg(0x0314 , 0x3B); 

        switch(mode) {
        case FLICKER_50HZ:
                Sensor_WriteReg(0x0315 , 0x16);                  			
                break;
        case FLICKER_60HZ:
                Sensor_WriteReg(0x0315 , 0x56);                  			
                break;
        default:
                return 0;
        }

        SENSOR_TRACE("set_GT2005_anti_flicker-mode=%d",mode);
        msleep(200);
        return 0;
}
예제 #2
0
static void lensS5K3E2_focus_gotoPosition(FOCUS_CATEGORY category, INT32 position)
{
    unsigned short Step;

    g_pFocusPara.iFocusPosition = position;

    Step = position;
    //debug_msg("%s,%d,%d\r\n",__func__,position,Step);
    if(Step)
    {
        Sensor_WriteReg(0x3130,0x03);
        Sensor_WriteReg(0x3131,(Step&0xff00)>>8);
        Sensor_WriteReg(0x3132,Step& 0xff);
    }else{
예제 #3
0
static INT32 lensS5K3E2_zoom_initPart2(void)
{
    //move from part1,because  part1 not init iic
    Sensor_WriteReg(0x3130,0x00);

    return ERR_OK;
}
LOCAL uint32_t Set_GT2005_Preview_Mode(uint32_t preview_mode)
{
        switch (preview_mode) {
        case DCAMERA_ENVIRONMENT_NORMAL: 
                Sensor_WriteReg(0x0312, 0x98);	// 1/2 Frame rate	
                break;
        case DCAMERA_ENVIRONMENT_NIGHT:
                Sensor_WriteReg(0x0312, 0xa8);	// 1/3 Frame rate	
                break;
        default:
                break;
        }
        SENSOR_TRACE("set_GT2005_preview_mode: level = %d", preview_mode);
        msleep(100);
        return 0;
}
LOCAL uint32_t _ov8830_StreamOn(uint32_t param)
{
	SENSOR_PRINT("SENSOR_ov8830: StreamOn");

	Sensor_WriteReg(0x0100, 0x01);

	return 0;
}
LOCAL void GT2005_Write_Group_Regs( SENSOR_REG_T* sensor_reg_ptr )
{
        uint32_t i;

        for(i = 0; (0xFF != sensor_reg_ptr[i].reg_addr) || (0xFF != sensor_reg_ptr[i].reg_value) ; i++) {
                Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
        }
}
LOCAL uint32_t _ov8830_StreamOff(uint32_t param)
{
	SENSOR_PRINT("SENSOR_ov8830: StreamOff");

	Sensor_WriteReg(0x0100, 0x00);
	usleep(50*1000);

	return 0;
}
예제 #8
0
LOCAL uint32_t _BF3905_StreamOff(uint32_t param)
{
	SENSOR_PRINT("SENSOR: _BF3905_StreamOff");
	int 	ret = 0;
	ret = Sensor_WriteReg(0x09, 0x01);  //81
		SENSOR_Sleep(20);

	return ret;
}
LOCAL uint32_t Sensor_Write_Regs( SENSOR_REG_T* sensor_reg_ptr )
{
    uint32_t i;
    
    for(i = 0; (0xFF != sensor_reg_ptr[i].reg_addr) && (0xFF != sensor_reg_ptr[i].reg_value) ; i++)
    {
        Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
    }
    return 0;
}
예제 #10
0
LOCAL uint32_t _BF3905_StreamOn(uint32_t param)
{
	SENSOR_PRINT("SENSOR: _BF3905_StreamOn");
	int 	ret = 0;
	uint16_t     read_val = 0;
	ret = Sensor_WriteReg(0x09, 0x01);
		SENSOR_Sleep(20);
	
	//SENSOR_PRINT("SENSOR: read_BF3905, reg:0x3012  val: 0x%x.\n", read_val);
	return ret;
}
LOCAL uint32_t OV9660_set_vmirror_enable(uint32_t enable)
{
	uint16_t reg04;
	
	Sensor_WriteReg(0xff, 0x01);
	reg04 = Sensor_ReadReg(0x04);
	
	if (enable)
	{
		reg04 = (reg04 | 0x50);
		Sensor_WriteReg(0xff, 0x01);
		Sensor_WriteReg(0x04, reg04);
	}
	else
	{
		reg04 = (reg04 & (~(0x50)));
		Sensor_WriteReg(0xff, 0x01);
		Sensor_WriteReg(0x04, reg04);
	}
	return 0;
}
LOCAL uint32_t OV7690_set_whitebalance_mode(uint32_t mode )
{
        uint16_t i;
        uint16_t temp;
        SENSOR_REG_T* sensor_reg_ptr = (SENSOR_REG_T*)OV7690_WB_mode_tab[mode];

        if(mode>6)
                return 0;

        temp = Sensor_ReadReg( 0x13 );
        if (mode < 1 ) {
                Sensor_WriteReg( 0x13, temp |BIT_1 );//	Auto mode : enable auto  white balanec
        } else {
                Sensor_WriteReg( 0x13, temp &( ~BIT_1) );//	other mode : disable auto white balanec
        }	
        for(i = 0; (0xFF != sensor_reg_ptr[i].reg_addr) || (0xFF != sensor_reg_ptr[i].reg_value); i++) {
                Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
        }
        SENSOR_TRACE("OV7690_set_whitebalance_mode: mode = %d", mode);
        return 0;
}
LOCAL uint32_t OV9660_set_ae_enable(uint32_t enable)
{
	unsigned char value;
	
	SENSOR_PRINT("OV9660_set_ae_enable: enable = %d", enable);
	
	value = Sensor_ReadReg(0x13);
	value &= 0xFE;
	value |= enable;
	Sensor_WriteReg(0x13, value);
	
	return 0;
}
LOCAL uint32_t OV7690_set_work_mode(uint32_t mode)
{
        uint16_t i;
        SENSOR_REG_T* sensor_reg_ptr = (SENSOR_REG_T*)OV7690_mode_tab[mode];
        SENSOR_ASSERT(mode <= 1);
        SENSOR_ASSERT(PNULL != sensor_reg_ptr);

        for(i = 0; (0xFF != sensor_reg_ptr[i].reg_addr) || (0xFF != sensor_reg_ptr[i].reg_value); i++) {
                Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
        }
        SENSOR_TRACE("OV7690_set_work_mode: mode = %d", mode);
        return 0;
}
LOCAL uint32_t SP0A19_set_brightness(uint32_t level)
{ 
    uint16_t i;
    SENSOR_REG_T* sensor_reg_ptr = (SENSOR_REG_T*)SP0A19_brightness_tab[level];

  //  SCI_ASSERT(PNULL != sensor_reg_ptr);
    
    for(i = 0; (0xFF != sensor_reg_ptr[i].reg_addr) || (0xFF != sensor_reg_ptr[i].reg_value) ; i++)
    {
        Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
    } 
    return 0;
}
LOCAL uint32_t set_ov7690_ev(uint32_t level)
{
        uint16_t i;    
        SENSOR_REG_T* sensor_reg_ptr = (SENSOR_REG_T*)ov7690_ev_tab[level];

        if(level>6)
                return 0;

        for(i = 0; (0xFF != sensor_reg_ptr[i].reg_addr) && (0xFF != sensor_reg_ptr[i].reg_value) ; i++) {
                Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
        }
        SENSOR_TRACE("SENSOR: set_ov7690_ev: level = %d", level);
        return 0;
}
LOCAL uint32_t SP0A19_set_image_effect(uint32_t effect_type)
{
    uint16_t  i;
    
    SENSOR_REG_T* sensor_reg_ptr = (SENSOR_REG_T*)SP0A19_image_effect_tab[effect_type];

   // SCI_ASSERT(PNULL != sensor_reg_ptr);

    for(i = 0; (0xFF != sensor_reg_ptr[i].reg_addr) || (0xFF != sensor_reg_ptr[i].reg_value) ; i++)
    {
        Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
    }
    return 0;
}
LOCAL uint32_t set_OV9660_video_mode(uint32_t mode)
{
        uint16_t i;
        SENSOR_REG_T* sensor_reg_ptr = PNULL;

        sensor_reg_ptr = (SENSOR_REG_T*)OV9660_video_mode_nand_tab[mode];

        for(i = 0; (0xFF != sensor_reg_ptr[i].reg_addr)|| (0xFF != sensor_reg_ptr[i].reg_value); i++) {
                Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
        }
        msleep(100); 
        SENSOR_PRINT("SENSOR: set_vodeo_mode: %d ",mode);
        return 0;
}
예제 #19
0
LOCAL uint32_t _BF3905_set_anti_flicker(uint32_t mode)
{

        
	SENSOR_REG_T_PTR sensor_reg_ptr=(SENSOR_REG_T_PTR)BF3905_anti_banding_flicker_tab[mode];
	uint16_t i=0x00;
        
	for(i=0x0; (0xff!=sensor_reg_ptr[i].reg_addr)||(0xff!=sensor_reg_ptr[i].reg_value); i++)
	{
		Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
	}

	SENSOR_PRINT("SENSOR: _BF3905_set_anti_flicker = 0x%02x \n", mode);

	return 0;
}
LOCAL uint32_t set_OV9660_ev(uint32_t level)
{
        uint16_t i;    
        SENSOR_REG_T* sensor_reg_ptr = (SENSOR_REG_T*)OV9660_ev_tab[level];

        if(level >= 7) {
                SENSOR_PRINT("set_OV9660_ev:param error,level=%d .\n",level);
                return SENSOR_FAIL;
        }
        for(i = 0;(0xFF != sensor_reg_ptr[i].reg_addr) || (0xFF != sensor_reg_ptr[i].reg_value); i++) {
                Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
        }
        msleep(100);
        SENSOR_PRINT("SENSOR: set_ev: level = %d", level);
        return 0;
}
LOCAL uint32_t set_OV9660_anti_flicker(uint32_t mode)
{//107 us
	uint16_t i;
	SENSOR_REG_T* sensor_reg_ptr = (SENSOR_REG_T*)OV9660_banding_flicker_tab[mode];

	//    SCI_ASSERT(PNULL != sensor_reg_ptr);

	for(i = 0; (0xFF != sensor_reg_ptr[i].reg_addr)|| (0xFF != sensor_reg_ptr[i].reg_value); i++)
	{
		Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
	}

	msleep(100); 
	SENSOR_PRINT("SENSOR: set_OV9660_flicker: 0x%x .\n", mode);
	return 0;
}
LOCAL uint32_t set_OV9660_awb(uint32_t mode)
{
        uint16_t i;
        SENSOR_REG_T* sensor_reg_ptr = (SENSOR_REG_T*)OV9660_awb_tab[mode];

        if(mode >= 7) {
                SENSOR_PRINT("set_OV9660_awb:param error,mode=%d\n",mode);
                return SENSOR_FAIL;
        }

        for(i = 0; (0xFF != sensor_reg_ptr[i].reg_addr) || (0xFF != sensor_reg_ptr[i].reg_value); i++) {
                Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
        }
        msleep(100); 
        SENSOR_PRINT("SENSOR: set_awb_mode: mode = %d", mode);
        return 0;
}
LOCAL uint32_t set_ov7690_video_mode(uint32_t mode)
{
        uint16_t i;
        SENSOR_REG_T* sensor_reg_ptr = PNULL;

        SENSOR_ASSERT(mode <= 1);
        if(1 == mode)
                s_preview_mode = DCAMERA_ENVIRONMENT_MAX;
        sensor_reg_ptr = (SENSOR_REG_T*)ov7690_video_mode_nand_tab[mode];
        SENSOR_ASSERT(PNULL != sensor_reg_ptr);
        for(i = 0; (0xFF != sensor_reg_ptr[i].reg_addr) || (0xFF != sensor_reg_ptr[i].reg_value); i++) {
                Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
        }
        DCAM_Sleep(150);
        SENSOR_TRACE("SENSOR: set_ov7690_video_mode: mode = %d", mode);
        return 0;
}
LOCAL void    GT2005_Set_Shutter(void)
{
        uint16_t shutter,AGain_shutter,DGain_shutter;

        Sensor_WriteReg(0x020B , 0x28);
        Sensor_WriteReg(0x020C , 0x44);
        Sensor_WriteReg(0x040B , 0x44);
        Sensor_WriteReg(0x0300 , 0xc1);
        shutter = (Sensor_ReadReg(0x0012)<<8 )|( Sensor_ReadReg(0x0013));    
        AGain_shutter = (Sensor_ReadReg(0x0014)<<8 )|( Sensor_ReadReg(0x0015));
        DGain_shutter = (Sensor_ReadReg(0x0016)<<8 )|( Sensor_ReadReg(0x0017));
        Sensor_WriteReg(0x0300 , 0x41); //close ALC
        shutter = shutter / 2; 
        Sensor_WriteReg(0x0305 , shutter&0xff);           
        Sensor_WriteReg(0x0304 , (shutter>>8)&0xff); 
        Sensor_WriteReg(0x0307 , AGain_shutter&0xff);      
        Sensor_WriteReg(0x0306 , (AGain_shutter>>8)&0xff); //AG
        Sensor_WriteReg(0x0308,  DGain_shutter&0xff);   //DG	
}
예제 #25
0
LOCAL uint32_t _BF3905_set_ev(uint32_t level)
{

        
	SENSOR_REG_T_PTR sensor_reg_ptr=(SENSOR_REG_T_PTR)BF3905_ev_tab[level];
	uint16_t i=0x00;
        
	if(level>6)
		return 0;

	for(i=0x00; (0xff!=sensor_reg_ptr[i].reg_addr)||(0xFF!=sensor_reg_ptr[i].reg_value); i++)
	{
		Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
	}

	SENSOR_PRINT("SENSOR: _BF3905_set_ev = 0x%02x \n", level);
	return 0;
}
LOCAL uint32_t GT2005_Before_Snapshot(uint32_t sensor_snapshot_mode)
{
        switch(sensor_snapshot_mode) {
        case SENSOR_MODE_PREVIEW_ONE:    //VGA
                SENSOR_TRACE("Capture VGA Size");
                break;
        case SENSOR_MODE_SNAPSHOT_ONE_FIRST:    // 1.3 M
        case SENSOR_MODE_SNAPSHOT_ONE_SECOND:    // 2 M
                SENSOR_TRACE("Capture 1.3M&2M Size");
                GT2005_Set_Shutter	();
                //PLL Setting 3FPS Under 10MHz PCLK 
                Sensor_WriteReg(0x0119 , 0x02);
                break;
        default:
        	break;
        }
        SENSOR_TRACE("SENSOR_GT2005: Before Snapshot");
        return 0;
}
예제 #27
0
LOCAL uint32_t _BF3905_set_brightness(uint32_t level)
{
	uint16_t i=0x00;
	uint32_t reg_bits = 0;
	uint32_t reg_value = 0;
            
	SENSOR_REG_T* sensor_reg_ptr=(SENSOR_REG_T*)BF3905_brightness_tab[level];

	if(level>6)
		return 0;

	for(i=0x00; (0xff!=sensor_reg_ptr[i].reg_addr)||(0xff!=sensor_reg_ptr[i].reg_value); i++)
	{
			Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
	}

	SENSOR_PRINT("SENSOR: _BF3905_set_brightness = 0x%02x,data=0x%x .\n", level,reg_value);
	return 0;
}
예제 #28
0
LOCAL uint32_t _BF3905_set_awb(uint32_t mode)
{
	uint16_t i=0x00;
	uint32_t reg_bits = 0;
	uint32_t reg_value = 0;
        

        
	SENSOR_REG_T* sensor_reg_ptr=(SENSOR_REG_T*)BF3905_awb_tab[mode];

        
          if(mode>4)
		return 0;
		  
	for(i=0; (0xff!=sensor_reg_ptr[i].reg_addr)||(0xFF!=sensor_reg_ptr[i].reg_value); i++)
	{
			Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
	}

	SENSOR_PRINT("SENSOR: _BF3905_set_awb = 0x%02x,reg_value=0x%x \n", mode,reg_value);
	return 0;
}
예제 #29
0
LOCAL uint32_t _BF3905_set_contrast(uint32_t level)
{
	uint16_t i=0x00;
	uint32_t reg_bits = 0;
	uint32_t reg_value = 0;

        
	SENSOR_REG_T* sensor_reg_ptr=(SENSOR_REG_T*)BF3905_contrast_tab[level];
        
	if(level>6)
		return 0;

	for(i=0x00; (0xff!=sensor_reg_ptr[i].reg_addr)||(0xFF!=sensor_reg_ptr[i].reg_value); i++)
	{
			Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);
	}

	//Sensor_SetSensorExifInfo(SENSOR_EXIF_CTRL_CONTRAST, (uint32)level);

	SENSOR_PRINT("SENSOR: _BF3905_set_contrast = 0x%02x,data=0x%x .\n", level,reg_value);
	return 0;
}
예제 #30
0
LOCAL uint32_t _BF3905_set_image_effect(uint32_t effect_type)
{
	uint16_t i=0x00;
	uint32_t reg_bits = 0;
	uint32_t reg_value = 0;

        
	SENSOR_REG_T* sensor_reg_ptr=(SENSOR_REG_T*)BF3905_image_effect_tab[effect_type];
        
	if(effect_type>7)
		return 0;

	for(i=0x00; (0xff!=sensor_reg_ptr[i].reg_addr)||(0xff!=sensor_reg_ptr[i].reg_value); i++)
	{

			Sensor_WriteReg(sensor_reg_ptr[i].reg_addr, sensor_reg_ptr[i].reg_value);

	}

	SENSOR_PRINT("SENSOR: _BF3905_set_image_effect = 0x%02x,data=0x%x \n", effect_type,reg_value);
	return 0;
}