ROV/src/Utilities/I2CAccess.cpp
int32_t I2CReadReg24(int fd, uint8_t reg)
{
	if (write(fd, &reg, 1) != 1) {
		return -1;
	}

	int32_t data = 0;
	if (read(fd, &data, 3) != 3) {
		return -1;
	}
	return data;
}
// Not using ioctl cause I couldn't figure out how and this is way easier
// Also I'm short on time... otherwise I would figure it out.
Not using ioctl cause I couldn't figure out how and this is way easier
Also I'm short on time... otherwise I would figure it out.
Not using ioctl cause I couldn ' t figure out how and this is way easier Also I ' m short on time ... otherwise I would figure it out .
int32_t I2CReadReg24(int fd, uint8_t reg)
{
	if (write(fd, &reg, 1) != 1) {
		return -1;
	}
	int32_t data = 0;
	if (read(fd, &data, 3) != 3) {
		return -1;
	}
	return data;
}
int32_t I2CReadReg24 ( int fd , uint8_t reg ) { if ( write ( fd , & reg , 1 ) != 1 ) { return -1 ; } int32_t data = 0 ; if ( read ( fd , & data , 3 ) != 3 ) { return -1 ; } return data ; }
Not using ioctl cause I couldn't figure out how and this is way easier
Also I'm short on time... otherwise I would figure it out.
Not using ioctl cause I couldn ' t figure out how and this is way easier Also I ' m short on time ... otherwise I would figure it out .