I have a a TPS65217 power chip and I am trying to program it using i2c with c or c++. I have seen a few examples of code now but they seem to be only for a 1 register chip as in they access the i2c address of the chip and then dont seem to access a particular register to read and write to. I guess my question is how do I read and write to a specific register on the power chip. I have an idea in my head about doing something like the following where I have an ioctl call to access the i2c address then to another iotcl inside the first if statement to access a register on the chip. Does any1 have any other idea while I try this or suggestions if this will work?
if (iotcl(file,I2C_SLAVE,I2C_ADDR) < 0 ){
printf("error");
return 1;
if (iotcl(file,I2C_SLAVE,register) < 0 {
printf("error")
return 1;
}
}