From 976c75fb89946e8605c9c81cd98e06db6a7135d9 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 21 Aug 2019 15:48:37 -0700 Subject: [PATCH] Remove stop kwarg and use write_then_readinto. See https://github.com/adafruit/circuitpython/issues/2082 for details. --- adafruit_lsm303.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/adafruit_lsm303.py b/adafruit_lsm303.py index 15acad1..ac2bfae 100644 --- a/adafruit_lsm303.py +++ b/adafruit_lsm303.py @@ -240,8 +240,8 @@ def mag_rate(self, value): def _read_u8(self, device, address): with 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 _write_u8(self, device, address, val): @@ -254,5 +254,4 @@ def _write_u8(self, device, 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)