Skip to content

Commit 7e30aad

Browse files
authored
Merge pull request #15 from tannewt/remove_stop
Remove stop kwarg and use write_then_readinto.
2 parents fe6796f + c6de17f commit 7e30aad

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

adafruit_lsm9ds1.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,8 @@ def _read_u8(self, sensor_type, address):
377377
device = self._xg_device
378378
with device as i2c:
379379
self._BUFFER[0] = address & 0xFF
380-
i2c.write(self._BUFFER, end=1, stop=False)
381-
i2c.readinto(self._BUFFER, end=1)
382-
return self._BUFFER[0]
380+
i2c.write_then_readinto(self._BUFFER, self._BUFFER, out_end=1, in_start=1, in_end=2)
381+
return self._BUFFER[1]
383382

384383
def _read_bytes(self, sensor_type, address, count, buf):
385384
if sensor_type == _MAGTYPE:
@@ -388,8 +387,7 @@ def _read_bytes(self, sensor_type, address, count, buf):
388387
device = self._xg_device
389388
with device as i2c:
390389
buf[0] = address & 0xFF
391-
i2c.write(buf, end=1, stop=False)
392-
i2c.readinto(buf, end=count)
390+
i2c.write_then_readinto(buf, buf, out_end=1, in_end=count)
393391

394392
def _write_u8(self, sensor_type, address, val):
395393
if sensor_type == _MAGTYPE:

0 commit comments

Comments
 (0)