From 7f1a0722793606cf58677715e53cf77bdcf42440 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 20 Aug 2019 21:58:16 -0700 Subject: [PATCH] Remove stop kwarg and use write_then_readinto. See https://github.com/adafruit/circuitpython/issues/2082 for details. --- adafruit_tsl2591.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/adafruit_tsl2591.py b/adafruit_tsl2591.py index 25b1b17..0a0171e 100644 --- a/adafruit_tsl2591.py +++ b/adafruit_tsl2591.py @@ -125,8 +125,7 @@ def _read_u8(self, address): with self._device as i2c: # Make sure to add command bit to read request. self._BUFFER[0] = (_TSL2591_COMMAND_BIT | address) & 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] # Disable invalid name check since pylint isn't smart enough to know LE @@ -138,8 +137,7 @@ def _read_u16LE(self, address): with self._device as i2c: # Make sure to add command bit to read request. self._BUFFER[0] = (_TSL2591_COMMAND_BIT | address) & 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] #pylint: enable=invalid-name