摄像头ov2685中关于sensor id 设置的相关的寄存器地址

来源:互联网 发布:淘宝铁观音卖家 编辑:程序博客网 时间:2024/06/05 04:52

OV2685 :

     CHIP_ID 

     address : 0x300A    default : 0x26

     address : 0x300B    default : 0x85

     address : 0x300C    defailt  : 0x00

回到早上的话题,如果我想查看摄像头的ID,我的代码可以这么写,在GPL329A-sensor-ID设置那里有完整的代码,这里我只给出小部分:

sensor_info.write_data[0] = 0x30;  sensor_info.write_data[1] = 0x0a;  sensor_info.write_size = 2;sensor_info.read_size = 2;ret = ioctl(fd, I2C_BUS_WRITE_READ, &sensor_info);if(ret < 0){<span style="white-space:pre"></span>perror("ioctl set i2c arg\n");continue; }readdevice = (sensor_info.read_data[0] << 8) + sensor_info.read_data[1];//if( readdevice == 0x2656)if(readdevice == 0x2685){DEBUG("I2C_BUS_WRITE_READ data = 0x%02x\n", readdevice);i = MAX_DEVICE + 1;<span style="white-space:pre"></span>deviceno = 2;}else{printf("Error I2C_BUS_WRITE_READ data = 0x%02x\n", readdevice);}
从代码上看:
sensor_info.write_data[0] = 0x30;  sensor_info.write_data[1] = 0x0a;
这个结构体数组的含义就是为了存储这两个寄存器的值,然后后面通过I2C总线去读取地址所对应的值,如果读出来的值为0x2685,这就说明设备已经被驱动了,同时也读出了相应的ID号。

1 0