|
|
|
@ -103,9 +103,7 @@ struct I2C::i2cImpl
|
|
|
|
|
throwError(falseAddrs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//send_buffer[0] = buffer;
|
|
|
|
|
|
|
|
|
|
if ((write(deviceDescriptor, send_buffer, len)) != len)
|
|
|
|
|
if ((write(deviceDescriptor,buffer, len)) != len)
|
|
|
|
|
{
|
|
|
|
|
throwError(writeFailed);
|
|
|
|
|
}
|
|
|
|
@ -113,7 +111,18 @@ struct I2C::i2cImpl
|
|
|
|
|
|
|
|
|
|
void readBuffer(const uint8_t& address, const uint8_t* buffer, uint8_t len)
|
|
|
|
|
{
|
|
|
|
|
uint16_t result = 0 ;
|
|
|
|
|
if (ioctl(deviceDescriptor, I2C_SLAVE, address) < 0)
|
|
|
|
|
{
|
|
|
|
|
throwError(falseAddrs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
writeByte(address,buffer[0]); //Initiate a write to indicate the desired register to read
|
|
|
|
|
|
|
|
|
|
if (read(deviceDescriptor, recieve_buffer, len) != len) // An then initare a read request of 2 bytes
|
|
|
|
|
{
|
|
|
|
|
throwError(writeFailed);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void throwError(I2C::errors errNo)
|
|
|
|
|