diff --git a/adafruit_vl6180x.py b/adafruit_vl6180x.py index 282e243..93fcc2e 100644 --- a/adafruit_vl6180x.py +++ b/adafruit_vl6180x.py @@ -276,7 +276,8 @@ def _read_8(self, address): # Read and return a byte from the specified 16-bit register address. with self._device as i2c: result = bytearray(1) - i2c.write_then_readinto(bytes([(address >> 8) & 0xFF, address & 0xFF]), result) + i2c.write(bytes([(address >> 8) & 0xFF, address & 0xFF])) + i2c.readinto(result) return result[0] def _read_16(self, address): @@ -284,5 +285,6 @@ def _read_16(self, address): # specified 16-bit register address. with self._device as i2c: result = bytearray(2) - i2c.write_then_readinto(bytes([(address >> 8) & 0xFF, address & 0xFF]), result) + i2c.write(bytes([(address >> 8) & 0xFF, address & 0xFF])) + i2c.readinto(result) return (result[0] << 8) | result[1]