From 1b8f5dcbbc33f5d6ad8235ff29507ecc97bfe638 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 20 Aug 2019 22:00:56 -0700 Subject: [PATCH] Remove stop kwarg and use write_then_readinto. See https://github.com/adafruit/circuitpython/issues/2082 for details. --- adafruit_tmp007.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/adafruit_tmp007.py b/adafruit_tmp007.py index b3e3f39..dedaf3d 100644 --- a/adafruit_tmp007.py +++ b/adafruit_tmp007.py @@ -166,15 +166,15 @@ def read_register(self, register): def _read_u8(self, address): with self._device as i2c: self._BUFFER[0] = 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] def _read_u16(self, address): with self._device as i2c: self._BUFFER[0] = 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[0]<<8 | self._BUFFER[1] def _write_u8(self, address, val): @@ -194,5 +194,4 @@ def _write_u16(self, address, val): def _read_bytes(device, address, count, buf): with device as i2c: buf[0] = address & 0xFF - i2c.write(buf, end=1, stop=False) - i2c.readinto(buf, end=count) + i2c.write_then_readinto(buf, buf, out_end=1, in_end=count)