diff --git a/adafruit_tcs34725.py b/adafruit_tcs34725.py index a4eb251..81d23d5 100644 --- a/adafruit_tcs34725.py +++ b/adafruit_tcs34725.py @@ -340,16 +340,16 @@ def _read_u8(self, address): # Read an 8-bit unsigned value from the specified 8-bit address. with self._device as i2c: self._BUFFER[0] = (address | _COMMAND_BIT) & 0xFF - i2c.write(self._BUFFER, end=1, stop=False) - i2c.readinto(self._BUFFER, end=1) + i2c.write_then_readinto(self._BUFFER, self._BUFFER, + out_end=1, in_end=1) return self._BUFFER[0] def _read_u16(self, address): # Read a 16-bit unsigned value from the specified 8-bit address. with self._device as i2c: self._BUFFER[0] = (address | _COMMAND_BIT) & 0xFF - i2c.write(self._BUFFER, end=1, stop=False) - i2c.readinto(self._BUFFER, end=2) + i2c.write_then_readinto(self._BUFFER, self._BUFFER, + out_end=1, in_end=2) return (self._BUFFER[1] << 8) | self._BUFFER[0] def _write_u8(self, address, val):