Is there an example program for i2c write?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is there an example program for i2c write?

1,175 Views
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) ????????

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


}

Labels (2)
Tags (1)
0 Kudos
1 Reply

555 Views
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 Kudos