Is there an example program for i2c write?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Is there an example program for i2c write?

1,185 次查看
ohseohwan
Contributor I

I need to setup the i2c by connecting the camera to the parallel port.
I need to set the camera through i2c writing, but i want to know how to set i2c in i.mx6 saber borad.

example code

int main(int argc, char *argv[])
{
    int i, j, dev;
    char buf[8];
    if ((dev = open("/dev/i2c-0", O_RDWR)) < 0) {
        perror("open failed");
        exit(1);
    }

    if (ioctl(dev, I2C_SLAVE, SLAVE_ADDR) < 0) {
        perror("ioctl failed");
        close(dev);
        exit(1);
    }

//---------------------

i2c write

write(dev,buf,1) ????????

//---------------------


}

标签 (2)
标记 (1)
0 项奖励
1 回复

565 次查看
igorpadykov
NXP Employee
NXP Employee

Hi OH

for such example one can look at ov5640 driver example described in

Chapter 19 OmniVision Camera Driver attached Linux Manual and

sect.19.1.3 Source Code Structure

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励