60int setI2C(
unsigned int index,
long slave_addr) {
63 sprintf(buf,
"/dev/i2c-%d", index);
65 if ((i2c_fd = open(buf, O_RDWR)) < 0) {
68 if (ioctl(i2c_fd, I2C_SLAVE, slave_addr) < 0) {
80 unsigned char bytes) {
81 unsigned char bytesWritten = write(i2c_fd, writebuffer, bytes);
82 if (bytes != bytesWritten) {
89 unsigned char bytes) {
90 unsigned char bytesRead = read(i2c_fd, readbuffer, bytes);
91 if (bytes != bytesRead)
int setI2C(unsigned int index, long slave_addr)
int writeI2C_asFile(int i2c_fd, unsigned char writebuffer[], unsigned char bytes)
int readI2C_asFile(int i2c_fd, unsigned char readbuffer[], unsigned char bytes)