From c6de17f9be46bfe6b2c4f692d9864179885e7b35 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 21 Aug 2019 15:47:18 -0700 Subject: [PATCH] Remove stop kwarg and use write_then_readinto. See https://github.com/adafruit/circuitpython/issues/2082 for details. --- adafruit_lsm9ds1.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/adafruit_lsm9ds1.py b/adafruit_lsm9ds1.py index 3a5e7cd..1238aa9 100644 --- a/adafruit_lsm9ds1.py +++ b/adafruit_lsm9ds1.py @@ -377,9 +377,8 @@ def _read_u8(self, sensor_type, address): device = self._xg_device with device as i2c: self._BUFFER[0] = address & 0xFF - i2c.write(self._BUFFER, end=1, stop=False) - i2c.readinto(self._BUFFER, end=1) - return self._BUFFER[0] + i2c.write_then_readinto(self._BUFFER, self._BUFFER, out_end=1, in_start=1, in_end=2) + return self._BUFFER[1] def _read_bytes(self, sensor_type, address, count, buf): if sensor_type == _MAGTYPE: @@ -388,8 +387,7 @@ def _read_bytes(self, sensor_type, address, count, buf): device = self._xg_device 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) def _write_u8(self, sensor_type, address, val): if sensor_type == _MAGTYPE: