diff --git a/developpment/communication/i2c/i2c_linux.hpp b/developpment/communication/i2c/i2c_linux.hpp index 9365bf3..32b0a81 100644 --- a/developpment/communication/i2c/i2c_linux.hpp +++ b/developpment/communication/i2c/i2c_linux.hpp @@ -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) diff --git a/developpment/runtest b/developpment/runtest deleted file mode 100755 index d3cd857..0000000 Binary files a/developpment/runtest and /dev/null differ